Bump to 0.1.7-test
This commit is contained in:
parent
0afcbb4633
commit
f3b7ffb3a1
@ -2,4 +2,4 @@ FROM python:3.11-alpine
|
|||||||
COPY ./requirements.txt /app/requirements.txt
|
COPY ./requirements.txt /app/requirements.txt
|
||||||
RUN [ "pip", "install", "-r", "/app/requirements.txt" ]
|
RUN [ "pip", "install", "-r", "/app/requirements.txt" ]
|
||||||
COPY ./src /app/src
|
COPY ./src /app/src
|
||||||
ENTRYPOINT [ "python", "/app/src/test.py" ]
|
CMD [ "python", "/app/src/main.py" ]
|
@ -14,7 +14,7 @@
|
|||||||
# program. If not, see
|
# program. If not, see
|
||||||
# https://git.fjla.uk/OwlBoard/db-manager/src/branch/main/LICENSE
|
# 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}")
|
print(f"main.py: Initialising db-manager v{version}")
|
||||||
|
|
||||||
#Third Party Imports
|
#Third Party Imports
|
||||||
|
18
src/mongo.py
18
src/mongo.py
@ -18,12 +18,12 @@ db = client[db_name]
|
|||||||
def metaCheckTime(target):
|
def metaCheckTime(target):
|
||||||
col = db["meta"]
|
col = db["meta"]
|
||||||
res = col.find_one({"target": target, "type": "collection"})
|
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")
|
log.out(f'mongo.metaUpdateTime: {target} last updated at {res["updated"]}', "INFO")
|
||||||
return res["updated"]
|
return res["updated"]
|
||||||
else:
|
log.out(f'mongo.metaUpdatetime: {target} does not exist', "INFO")
|
||||||
log.out(f'mongo.metaUpdatetime: {target} does not exist', "INFO")
|
return 0
|
||||||
return 0
|
|
||||||
|
|
||||||
def metaUpdateTime(target):
|
def metaUpdateTime(target):
|
||||||
col = db["meta"]
|
col = db["meta"]
|
||||||
@ -82,9 +82,11 @@ def metaCounters():
|
|||||||
collection = "meta"
|
collection = "meta"
|
||||||
col = db[collection]
|
col = db[collection]
|
||||||
res = col.find_one({"target": "counters","type": "count"})
|
res = col.find_one({"target": "counters","type": "count"})
|
||||||
if 'since' not in res:
|
log.out(f'mongo.metaCounters: Query returned `{res}`', "DEBG")
|
||||||
log.out('mongo.metaCounters: counters does not exist, creating', "INFO")
|
if type(res) is dict:
|
||||||
col.update_one({"target": "counters","type": "count"}, {"target": "counters","type": "count","since": int(time.time())})
|
if 'since' in res:
|
||||||
else:
|
|
||||||
log.out('mongo.metaCounters: counters already exists, skipping', "INFO")
|
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
|
return
|
Reference in New Issue
Block a user