Bump to 0.1.7-test

This commit is contained in:
Fred Boniface 2023-02-13 20:45:05 +00:00
parent 0afcbb4633
commit f3b7ffb3a1
3 changed files with 12 additions and 10 deletions

View File

@ -2,4 +2,4 @@ FROM python:3.11-alpine
COPY ./requirements.txt /app/requirements.txt
RUN [ "pip", "install", "-r", "/app/requirements.txt" ]
COPY ./src /app/src
ENTRYPOINT [ "python", "/app/src/test.py" ]
CMD [ "python", "/app/src/main.py" ]

View File

@ -14,7 +14,7 @@
# program. If not, see
# https://git.fjla.uk/OwlBoard/db-manager/src/branch/main/LICENSE
version = "0.1.0"
version = "0.1.7"
print(f"main.py: Initialising db-manager v{version}")
#Third Party Imports

View File

@ -18,12 +18,12 @@ db = client[db_name]
def metaCheckTime(target):
col = db["meta"]
res = col.find_one({"target": target, "type": "collection"})
if 'updated' in res:
if type(res) is dict:
if 'updated' in res:
log.out(f'mongo.metaUpdateTime: {target} last updated at {res["updated"]}', "INFO")
return res["updated"]
else:
log.out(f'mongo.metaUpdatetime: {target} does not exist', "INFO")
return 0
log.out(f'mongo.metaUpdatetime: {target} does not exist', "INFO")
return 0
def metaUpdateTime(target):
col = db["meta"]
@ -82,9 +82,11 @@ def metaCounters():
collection = "meta"
col = db[collection]
res = col.find_one({"target": "counters","type": "count"})
if 'since' not in res:
log.out('mongo.metaCounters: counters does not exist, creating', "INFO")
col.update_one({"target": "counters","type": "count"}, {"target": "counters","type": "count","since": int(time.time())})
else:
log.out(f'mongo.metaCounters: Query returned `{res}`', "DEBG")
if type(res) is dict:
if 'since' in res:
log.out('mongo.metaCounters: counters already exists, skipping', "INFO")
return
log.out('mongo.metaCounters: counters does not exist, creating', "INFO")
col.update_one({"target": "counters","type": "count"}, {"$set":{"target": "counters","type": "count","since": int(time.time())}}, upsert=True)
return