Skip to content

Commit

Permalink
Merge pull request #319 from michamos/fix-desy-error
Browse files Browse the repository at this point in the history
DESY: ensure a single app context is in use
  • Loading branch information
michamos committed Dec 7, 2021
2 parents 8341594 + fb514e8 commit 2a4144b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hepcrawl/spiders/desy_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ def parse(self, response):
file_name=file_name
)

# make sure we don't yield control to scrapy while an app context is
# running to ensure different contexts don't get interleaved which
# Flask doesn't handle correctly (single global app context stack)
parsed_items = list(parsed_items)
for parsed_item in parsed_items:
yield parsed_item

Expand Down

0 comments on commit 2a4144b

Please sign in to comment.