Skip to content

Commit 55f2474

Browse files
committed
In Storage.update_feed(), accumulate all values in the context dict.
1 parent bc8a02e commit 55f2474

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/reader/_storage/_feeds.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ def update_feed(self, intent: FeedUpdateIntent) -> None:
231231
'last_retrieved': adapt_datetime(intent.last_retrieved),
232232
'update_after': adapt_datetime(intent.update_after),
233233
}
234-
expressions: list[str] = []
235234

236235
if isinstance(value, FeedToUpdate):
237236
assert url == value.feed.url, "updating feed URL not supported"
@@ -251,17 +250,15 @@ def update_feed(self, intent: FeedUpdateIntent) -> None:
251250
)
252251
context.pop('hash', None)
253252

254-
expressions.append("stale = 0")
255-
256-
expressions.extend(f"{n} = :{n}" for n in context if n != 'url')
253+
context['stale'] = 0
257254

258255
if isinstance(value, ExceptionInfo):
259256
context['last_exception'] = json.dumps(value._asdict())
260-
expressions.append("last_exception = :last_exception")
261257
else:
262258
assert isinstance(value, FeedToUpdate | None)
263-
expressions.append("last_exception = NULL")
259+
context['last_exception'] = None
264260

261+
expressions = [f"{n} = :{n}" for n in context if n != 'url']
265262
query = f"UPDATE feeds SET {', '.join(expressions)} WHERE url = :url;"
266263

267264
with self.get_db() as db:

0 commit comments

Comments
 (0)