Skip to content

Commit

Permalink
fix: Heatmap Updater Crash (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
eugena committed Jul 2, 2022
1 parent dd8e91c commit 78e1091
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion my_tourist/conf/management/commands/update_heat_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def get_stat(browser, queries, regions_keys):

for q in tqdm(queries):
browser.get(settings.WORD_STAT["url"] + q)
time.sleep(np.random.random())
time.sleep(5 + 10 * np.random.random() + 5 * np.random.random())

page_data = WebDriverWait(browser, settings.WORD_STAT["timeout"]).until(
lambda x: x.find_element_by_class_name("b-regions-statistic_js_inited")
Expand Down Expand Up @@ -247,6 +247,8 @@ def handle(self, *args, **options):
stat = Command.get_stat(browser, queries, regions_keys)
stat = Command.calc_extra(stat)
Command.save_data(stat, regions_instances, region, tourism_type)

time.sleep(10 * np.random.random())
else:
self.stdout.write(self.style.ERROR("Wrong region code."))
else:
Expand Down

0 comments on commit 78e1091

Please sign in to comment.