Skip to content

Commit ac01feb

Browse files
committed
exception for already downlaoded groups
1 parent f5f05c2 commit ac01feb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

mapswipe_workers/utils/import_firebase_to_psql.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,21 @@ def download_all_groups_tasks(firebase):
307307

308308
all_projects = fb_db.child("projects").get().val()
309309

310-
for project in all_projects.keys():
310+
downloaded_groups = []
311+
downloaded_files = os.listdir('data')
312+
313+
for file in downloaded_files:
314+
if file.endswith('_groups.csv'):
315+
downloaded_groups.append(file.split('_')[0])
311316

317+
for project in all_projects.keys():
318+
# skip downlaoded groups
319+
if project in downloaded_groups:
320+
continue
312321
group_ids = fb_db.child("groups").child(project).shallow().get().val()
313322

314323
# this tries to set the max pool connections to 100
315-
adapter = requests.adapters.HTTPAdapter(max_retries=5, pool_connections=100, pool_maxsize=100)
324+
adapter = requests.adapters.HTTPAdapter(max_retries=10, pool_connections=100, pool_maxsize=100)
316325
for scheme in ('http://', 'https://'):
317326
fb_db.requests.mount(scheme, adapter)
318327

0 commit comments

Comments
 (0)