Skip to content

Commit

Permalink
fix spider for russia file, db count optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
takb committed Feb 19, 2021
1 parent 2e13339 commit cb3ad31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion openpoiservice/server/db_import/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def run_import(osm_files_to_import, import_log):
update_mode = False
# run query on separate database connection, will conflict otherwise since parse_import runs in separate process
separate_db_con = SQLAlchemy()
prev_poi_count = separate_db_con.session.query(POIs).count()
prev_poi_count = separate_db_con.session.query(POIs.osm_type, POIs.osm_id).count()
if prev_poi_count > 0:
update_mode = True
logger.info("Data import running in UPDATE MODE")
Expand Down
5 changes: 4 additions & 1 deletion osm/GeoFabrikSpider.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def fetch_sub_regions(self, response):

print('Starting download of {}'.format(tail))
download_link = parse.urljoin(response.url, sub_region)
subprocess.call(["wget", "-q", "-N", f"-P{head}", download_link])
if head:
subprocess.call(["wget", "-q", "-N", f"-P{head}", download_link])
else:
subprocess.call(["wget", "-q", "-N", download_link])
sleep(self.wait_time)

yield {
Expand Down

0 comments on commit cb3ad31

Please sign in to comment.