MCPcopy Create free account
hub / github.com/RocketMap/RocketMap / db_updater

Function db_updater

pogom/models.py:840–865  ·  view source on GitHub ↗
(args, q)

Source from the content-addressed store, hash-verified

838
839
840def db_updater(args, q):
841 # The forever loop
842 while True:
843 try:
844
845 while True:
846 try:
847 flaskDb.connect_db()
848 break
849 except Exception as e:
850 log.warning('%s... Retrying', e)
851
852 # Loop the queue
853 while True:
854 model, data = q.get()
855 bulk_upsert(model, data)
856 q.task_done()
857 log.debug('Upserted to %s, %d records (upsert queue remaining: %d)',
858 model.__name__,
859 len(data),
860 q.qsize())
861 if q.qsize() > 50:
862 log.warning("DB queue is > 50 (@%d); try increasing --db-threads", q.qsize())
863
864 except Exception as e:
865 log.exception('Exception in db_updater: %s', e)
866
867
868def clean_db_loop(args):

Callers

nothing calls this directly

Calls 1

bulk_upsertFunction · 0.85

Tested by

no test coverage detected