summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Grönholm <alex.gronholm@nextday.fi>2022-04-20 01:40:22 +0300
committerAlex Grönholm <alex.gronholm@nextday.fi>2022-04-20 01:40:40 +0300
commit46feee2d3aa59b8cd6f2f90e99c5a06f63cc3c60 (patch)
tree6bee7c3de9450090d6a464f8e0b66cd3f1ab084f /src
parentb1a011c9436e0d47e4646f21e6c54335aa47ab05 (diff)
downloadapscheduler-46feee2d3aa59b8cd6f2f90e99c5a06f63cc3c60.tar.gz
Fixed SQLAlchemy stores failing on multiple schedule release
This only happened where RETURNING was supported for updates (PostgreSQL). Fixes #621.
Diffstat (limited to 'src')
-rw-r--r--src/apscheduler/datastores/async_sqlalchemy.py13
-rw-r--r--src/apscheduler/datastores/sqlalchemy.py12
2 files changed, 6 insertions, 19 deletions
diff --git a/src/apscheduler/datastores/async_sqlalchemy.py b/src/apscheduler/datastores/async_sqlalchemy.py
index 5362e71..7055fef 100644
--- a/src/apscheduler/datastores/async_sqlalchemy.py
+++ b/src/apscheduler/datastores/async_sqlalchemy.py
@@ -374,16 +374,9 @@ class AsyncSQLAlchemyDataStore(_BaseSQLAlchemyDataStore, AsyncDataStore):
next_fire_times = {
arg["p_id"]: arg["p_next_fire_time"] for arg in update_args
}
- if self._supports_update_returning:
- update = update.returning(self.t_schedules.c.id)
- updated_ids = [
- row[0]
- for row in await conn.execute(update, update_args)
- ]
- else:
- # TODO: actually check which rows were updated?
- await conn.execute(update, update_args)
- updated_ids = list(next_fire_times)
+ # TODO: actually check which rows were updated?
+ await conn.execute(update, update_args)
+ updated_ids = list(next_fire_times)
for schedule_id in updated_ids:
event = ScheduleUpdated(
diff --git a/src/apscheduler/datastores/sqlalchemy.py b/src/apscheduler/datastores/sqlalchemy.py
index 8ff90c4..cca223e 100644
--- a/src/apscheduler/datastores/sqlalchemy.py
+++ b/src/apscheduler/datastores/sqlalchemy.py
@@ -500,15 +500,9 @@ class SQLAlchemyDataStore(_BaseSQLAlchemyDataStore, DataStore):
next_fire_times = {
arg["p_id"]: arg["p_next_fire_time"] for arg in update_args
}
- if self._supports_update_returning:
- update = update.returning(self.t_schedules.c.id)
- updated_ids = [
- row[0] for row in conn.execute(update, update_args)
- ]
- else:
- # TODO: actually check which rows were updated?
- conn.execute(update, update_args)
- updated_ids = list(next_fire_times)
+ # TODO: actually check which rows were updated?
+ conn.execute(update, update_args)
+ updated_ids = list(next_fire_times)
for schedule_id in updated_ids:
event = ScheduleUpdated(