Bump to 1.0.5

This commit is contained in:
Fred Boniface 2023-02-16 22:17:35 +00:00
parent 9db0aab561
commit 4e380935e7
3 changed files with 6 additions and 5 deletions

View File

@ -16,7 +16,7 @@ CORPUS_PASS = os.getenv('OWL_LDB_CORPUSPASS')
def fetch():
log.out("corpus.fetch: Fetching CORPUS Data from Network Rail", "INFO")
response = requests.get(CORPUS_URL, auth=(CORPUS_USER, CORPUS_PASS))
incrementCounter("corpus_api")
mongo.incrementCounter("corpus_api")
log.out("corpus.fetch: Decompressing & parsing CORPUS data", "INFO")
parsed = json.loads(zlib.decompress(response.content, 16+zlib.MAX_WBITS).decode())
return parsed['TIPLOCDATA']

View File

@ -14,7 +14,7 @@
# program. If not, see
# https://git.fjla.uk/OwlBoard/db-manager/src/branch/main/LICENSE
version = "1.0.0"
version = "1.0.5"
print(f"main.py: Initialising db-manager v{version}")
#Third Party Imports
@ -36,14 +36,14 @@ if corpusAge > 1036800:
corpusData = corpus.removeEmpty(corpus.fetch())
mongo.putBulkCorpus(corpusData)
else:
log.out('main.py: Not updating CORPUS data', "INFO")
log.out('main.py: Not updating CORPUS data until it is 1036800s old.', "INFO")
stationsAge = int(time.time()) - mongo.metaCheckTime("stations")
log.out(f'main.py: Stations is {stationsAge}s old', "INFO")
# While the source of stations data is CORPUS, this statement is based on corpusAge, when/if changing the source, it should be changed to use stationsAge
# if stationsAge is used now, there could be a situation where stationsAge tries to update but fails as corpusData doesn't exist.
if corpusAge > 1036800:
log.out('main.py: Updating stations data', "INFO")
log.out('main.py: Updating stations data until it is 1036800s old.', "INFO")
stationData = corpus.onlyStations(corpusData)
mongo.putBulkStations(stationData)
else:

View File

@ -86,7 +86,8 @@ def putBulkStations(data):
def incrementCounter(target):
collection = "meta"
col = db[collection]
col.update_one({"target": "counters"}, {"$inc":target})
log.out(f'mongo.incrementCounter: Incrementing counter for {target}', "INFO")
col.update_one({"target": "counters","type": "count"}, {"$inc":{target: 1}})
return
def metaCounters():