Pequeños refactorings.
This commit is contained in:
parent
227f298d8b
commit
5ec97ad008
2 changed files with 7 additions and 4 deletions
|
|
@ -22,13 +22,15 @@ class Capturer:
|
|||
|
||||
while True:
|
||||
|
||||
if (capturing_interface.get_pending_task() is None
|
||||
or self.seconds_since_last_try() < minimum_seconds_between_tries
|
||||
if (self.seconds_since_last_try() < minimum_seconds_between_tries
|
||||
or not self.in_working_hours()):
|
||||
sleep(Capturer.sleep_time_no_work)
|
||||
continue
|
||||
|
||||
task = CapturingTask(capturing_interface.get_pending_task())
|
||||
pending_task = capturing_interface.get_pending_task()
|
||||
if not pending_task:
|
||||
continue
|
||||
task = CapturingTask(pending_task)
|
||||
self.last_try_datetime = datetime.datetime.now()
|
||||
task.capture()
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from time import sleep
|
|||
from db_layer.capturas_interface import capturas_interface
|
||||
from core.config import google_api_key, geocoder_delay
|
||||
|
||||
|
||||
class Geocoder:
|
||||
|
||||
def __init__(self):
|
||||
|
|
@ -74,7 +75,7 @@ class Geocoder:
|
|||
|
||||
class GeocodingCache:
|
||||
|
||||
cache_max_size = 1000
|
||||
cache_max_size = 2000
|
||||
|
||||
def __init__(self):
|
||||
self.geocoded_addresses = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue