File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020
2121
2222def fetch_db ():
23- r = requests .get (DB_URL )
23+ logger .info ("fetch called" )
24+ if os .path .exists (PATH ):
25+ os .remove (PATH )
26+ r = requests .get (DB_URL , stream = True )
2427 if r .status_code == 200 :
2528 with gzip .open (r .raw , 'rb' ) as infile :
2629 with open (PATH , 'wb' ) as outfile :
@@ -52,7 +55,7 @@ def update_db():
5255 print ("fetch_db finished" )
5356 return geoip2 .database .Reader (PATH )
5457 except Exception as e :
55- print (e )
58+ print ("GEOERROR" + e )
5659
5760
5861def check_db (loop ):
@@ -63,7 +66,7 @@ def check_db(loop):
6366 global geoip_reader
6467 if not geoip_reader :
6568 logger .info ("Loading GeoIP database" )
66- db = yield from loop .run_in_executor (None , update_db , geoip_reader )
69+ db = yield from loop .run_in_executor (None , update_db )
6770 logger .info ("Loaded GeoIP database" )
6871 geoip_reader = db
6972
You can’t perform that action at this time.
0 commit comments