Update DB Strings
This commit is contained in:
@@ -11,19 +11,20 @@ db_user = urllib.parse.quote_plus(os.getenv('OWL_DB_USER', "owl"))
|
||||
db_pass = urllib.parse.quote_plus(os.getenv('OWL_DB_PASS', "twittwoo"))
|
||||
db_name = os.getenv('OWL_DB_NAME', "owlboard")
|
||||
|
||||
log.out(f"mongo.py: Connecting to database at {db_host}:{db_port}", "INFOm")
|
||||
client = MongoClient(f"mongodb://{db_user}:{db_pass}@{db_host}:{db_port}")
|
||||
db = client[db_name]
|
||||
|
||||
def metaCheckTime(target):
|
||||
col = db["meta"]
|
||||
res = col.find_one({"target": target})
|
||||
res = col.find_one({"target": target, "type": "collection"})
|
||||
log.out(f'mongo.metaUpdateTime: {target} last updated at {res["updated"]}', "INFO")
|
||||
return res["updated"]
|
||||
|
||||
def metaUpdateTime(target):
|
||||
col = db["meta"]
|
||||
log.out(f'mongo.metaUpdateTime: Updating updated time for {target}', "INFO")
|
||||
res = col.update_one({"target": target}, {"$set":{"updated": int(time.time())}}, upsert=True)
|
||||
res = col.update_one({"target": target, "type":"collection"}, {"$set":{"updated": int(time.time()),"target":target, "type":"collection"}}, upsert=True)
|
||||
|
||||
def getLength(collection):
|
||||
col = db[collection]
|
||||
|
||||
5
src/test.py
Normal file
5
src/test.py
Normal file
@@ -0,0 +1,5 @@
|
||||
import time
|
||||
|
||||
while True:
|
||||
print("Running...")
|
||||
time.sleep(10)
|
||||
Reference in New Issue
Block a user