Skip to content

Commit

Permalink
don't commit silently in helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
facundoolano committed Jan 3, 2024
1 parent d373d18 commit 6f2f233
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion feedi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ def fetch_content(self):
if self.content_url and not self.content_full:
try:
self.content_full = scraping.extract(self.content_url)['content']
db.session.commit()
except Exception:
pass

Expand Down
1 change: 1 addition & 0 deletions feedi/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ def entry_view(id):
# if full browser load or explicit content request, fetch the article synchronously
entry.fetch_content()
if entry.content_full:
db.session.commit()
return flask.render_template("entry_content.html", entry=entry, content=entry.content_full)

return redirect_response(entry.target_url)
Expand Down
1 change: 1 addition & 0 deletions feedi/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def content_prefetch():
for entry in db.session.scalars(query):
app.logger.debug('Prefetching %s', entry.content_url)
entry.fetch_content()
db.session.commit()


@feed_cli.command('purge')
Expand Down

0 comments on commit 6f2f233

Please sign in to comment.