Bump to 1.0.5
This commit is contained in:
parent
9db0aab561
commit
4e380935e7
@ -16,7 +16,7 @@ CORPUS_PASS = os.getenv('OWL_LDB_CORPUSPASS')
|
|||||||
def fetch():
|
def fetch():
|
||||||
log.out("corpus.fetch: Fetching CORPUS Data from Network Rail", "INFO")
|
log.out("corpus.fetch: Fetching CORPUS Data from Network Rail", "INFO")
|
||||||
response = requests.get(CORPUS_URL, auth=(CORPUS_USER, CORPUS_PASS))
|
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")
|
log.out("corpus.fetch: Decompressing & parsing CORPUS data", "INFO")
|
||||||
parsed = json.loads(zlib.decompress(response.content, 16+zlib.MAX_WBITS).decode())
|
parsed = json.loads(zlib.decompress(response.content, 16+zlib.MAX_WBITS).decode())
|
||||||
return parsed['TIPLOCDATA']
|
return parsed['TIPLOCDATA']
|
||||||
|
@ -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 = "1.0.0"
|
version = "1.0.5"
|
||||||
print(f"main.py: Initialising db-manager v{version}")
|
print(f"main.py: Initialising db-manager v{version}")
|
||||||
|
|
||||||
#Third Party Imports
|
#Third Party Imports
|
||||||
@ -36,14 +36,14 @@ if corpusAge > 1036800:
|
|||||||
corpusData = corpus.removeEmpty(corpus.fetch())
|
corpusData = corpus.removeEmpty(corpus.fetch())
|
||||||
mongo.putBulkCorpus(corpusData)
|
mongo.putBulkCorpus(corpusData)
|
||||||
else:
|
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")
|
stationsAge = int(time.time()) - mongo.metaCheckTime("stations")
|
||||||
log.out(f'main.py: Stations is {stationsAge}s old', "INFO")
|
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
|
# 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 stationsAge is used now, there could be a situation where stationsAge tries to update but fails as corpusData doesn't exist.
|
||||||
if corpusAge > 1036800:
|
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)
|
stationData = corpus.onlyStations(corpusData)
|
||||||
mongo.putBulkStations(stationData)
|
mongo.putBulkStations(stationData)
|
||||||
else:
|
else:
|
||||||
|
@ -86,7 +86,8 @@ def putBulkStations(data):
|
|||||||
def incrementCounter(target):
|
def incrementCounter(target):
|
||||||
collection = "meta"
|
collection = "meta"
|
||||||
col = db[collection]
|
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
|
return
|
||||||
|
|
||||||
def metaCounters():
|
def metaCounters():
|
||||||
|
Reference in New Issue
Block a user