python3-cyberfusion-queue-support 3.0.2__py3-none-any.whl → 3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -104,9 +104,7 @@ class QueueProcess(BaseModel):
104
104
  __tablename__ = "queue_processes"
105
105
 
106
106
  queue_id = Column(
107
- Integer,
108
- ForeignKey("queues.id", ondelete="CASCADE"),
109
- nullable=False,
107
+ Integer, ForeignKey("queues.id", ondelete="CASCADE"), nullable=False, index=True
110
108
  )
111
109
  preview = Column(Boolean, nullable=False)
112
110
  status = Column(Enum(QueueProcessStatus), nullable=True)
@@ -125,9 +123,7 @@ class QueueItem(BaseModel):
125
123
  __tablename__ = "queue_items"
126
124
 
127
125
  queue_id = Column(
128
- Integer,
129
- ForeignKey("queues.id", ondelete="CASCADE"),
130
- nullable=False,
126
+ Integer, ForeignKey("queues.id", ondelete="CASCADE"), nullable=False, index=True
131
127
  )
132
128
  type = Column(String(length=255), nullable=False)
133
129
  reference = Column(String(length=255), nullable=True)
@@ -154,11 +150,13 @@ class QueueItemOutcome(BaseModel):
154
150
  Integer,
155
151
  ForeignKey("queue_items.id", ondelete="CASCADE"),
156
152
  nullable=False,
153
+ index=True,
157
154
  )
158
155
  queue_process_id = Column(
159
156
  Integer,
160
157
  ForeignKey("queue_processes.id", ondelete="CASCADE"),
161
158
  nullable=False,
159
+ index=True,
162
160
  )
163
161
  type = Column(String(length=255), nullable=False)
164
162
  attributes = Column(JSON, nullable=False)
@@ -0,0 +1,52 @@
1
+ """Add indexes
2
+
3
+ Revision ID: 93c79cb2baba
4
+ Revises: 2f4316506856
5
+ Create Date: 2025-10-03 13:55:00.001141
6
+
7
+ """
8
+
9
+ from alembic import op
10
+
11
+
12
+ # revision identifiers, used by Alembic.
13
+ revision = "93c79cb2baba"
14
+ down_revision = "2f4316506856"
15
+ branch_labels = None
16
+ depends_on = None
17
+
18
+
19
+ def upgrade() -> None:
20
+ with op.batch_alter_table("queue_item_outcomes", schema=None) as batch_op:
21
+ batch_op.create_index(
22
+ batch_op.f("ix_queue_item_outcomes_queue_item_id"),
23
+ ["queue_item_id"],
24
+ unique=False,
25
+ )
26
+ batch_op.create_index(
27
+ batch_op.f("ix_queue_item_outcomes_queue_process_id"),
28
+ ["queue_process_id"],
29
+ unique=False,
30
+ )
31
+
32
+ with op.batch_alter_table("queue_items", schema=None) as batch_op:
33
+ batch_op.create_index(
34
+ batch_op.f("ix_queue_items_queue_id"), ["queue_id"], unique=False
35
+ )
36
+
37
+ with op.batch_alter_table("queue_processes", schema=None) as batch_op:
38
+ batch_op.create_index(
39
+ batch_op.f("ix_queue_processes_queue_id"), ["queue_id"], unique=False
40
+ )
41
+
42
+
43
+ def downgrade() -> None:
44
+ with op.batch_alter_table("queue_processes", schema=None) as batch_op:
45
+ batch_op.drop_index(batch_op.f("ix_queue_processes_queue_id"))
46
+
47
+ with op.batch_alter_table("queue_items", schema=None) as batch_op:
48
+ batch_op.drop_index(batch_op.f("ix_queue_items_queue_id"))
49
+
50
+ with op.batch_alter_table("queue_item_outcomes", schema=None) as batch_op:
51
+ batch_op.drop_index(batch_op.f("ix_queue_item_outcomes_queue_process_id"))
52
+ batch_op.drop_index(batch_op.f("ix_queue_item_outcomes_queue_item_id"))
@@ -11,11 +11,8 @@ def main() -> None:
11
11
  days=settings.queue_purge_days
12
12
  )
13
13
 
14
- queues = (
15
- database_session.query(Queue).filter(Queue.created_at < purge_before_date).all()
16
- )
14
+ queues = database_session.query(Queue).filter(Queue.created_at < purge_before_date)
17
15
 
18
- for queue in queues:
19
- database_session.delete(queue)
16
+ queues.delete()
20
17
 
21
18
  database_session.commit()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python3-cyberfusion-queue-support
3
- Version: 3.0.2
3
+ Version: 3.1
4
4
  Summary: Library to queue actions.
5
5
  Author-email: Cyberfusion <support@cyberfusion.io>
6
6
  Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
@@ -1,5 +1,5 @@
1
1
  cyberfusion/QueueSupport/__init__.py,sha256=KvLhTLBUE3aUMc-HetRzAgPxYNIvnJ4sixqbw0WVuVo,4836
2
- cyberfusion/QueueSupport/database.py,sha256=cAFG587-ljpsbBq9hnyqWxy4IHkllH1KptLmzA5TQmo,4711
2
+ cyberfusion/QueueSupport/database.py,sha256=SRGHi0MJ7GerGcKOvEpu4lp82OfYf-Ev_eZeJ1PmexM,4741
3
3
  cyberfusion/QueueSupport/encoders.py,sha256=SzuMoyr2q3ME8LI_bZtpP76Xg7SP0B4O4uUuywrDwBI,1532
4
4
  cyberfusion/QueueSupport/enums.py,sha256=XzOy5J4sa7SOCKNFyw9kw3MyqDkjPookbfiMQHRHGfQ,122
5
5
  cyberfusion/QueueSupport/interfaces.py,sha256=ip8z6cfLFldQCDSec6fK6AIOdxOjIyFykDv4dCHJYSI,943
@@ -39,12 +39,13 @@ cyberfusion/QueueSupport/migrations/versions/52d1b17abcd0_add_status.py,sha256=g
39
39
  cyberfusion/QueueSupport/migrations/versions/571e55ab5ed5_initial_migration.py,sha256=1yYFZhQyHVnn1nHXxLVRb94V7gXprWYMfIDhF0_DPVU,2845
40
40
  cyberfusion/QueueSupport/migrations/versions/8023b9eecdd1_add_traceback_to_queue_items.py,sha256=IfwqqHeE6e4iDH3bc6FrOgdBT4w-Kxa2MYv0dzYjEbk,497
41
41
  cyberfusion/QueueSupport/migrations/versions/8406a0af7394_set_status_on_existing_queue_processes.py,sha256=fhfeErva3B3rrmr6-cbGO8DrjXU6qp1sIzVJGzOJ7iI,424
42
+ cyberfusion/QueueSupport/migrations/versions/93c79cb2baba_add_indexes.py,sha256=raIrgSg6b4CboiSvtzhBy7q7kuREb8FeYKCUtBTaYbM,1651
42
43
  cyberfusion/QueueSupport/migrations/versions/9ae29b5db790_add_string_to_queue_item_outcomes.py,sha256=CzNJVL5Ia_J5woGsnCRSrlraoaT8YfgZUVOlAWHjb2Y,546
43
44
  cyberfusion/QueueSupport/migrations/versions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
45
  cyberfusion/QueueSupport/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
- cyberfusion/QueueSupport/scripts/purge_queues.py,sha256=0i77UEK_dzCof0I3wF0zagc6FXhx3obv7x5Ocju3i0M,539
46
- python3_cyberfusion_queue_support-3.0.2.dist-info/METADATA,sha256=wE3ev0V6eERbHKM1JPe72e4VG1QN0iU3mPuomJR9yIc,4621
47
- python3_cyberfusion_queue_support-3.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
48
- python3_cyberfusion_queue_support-3.0.2.dist-info/entry_points.txt,sha256=z7WykKo9hbm5I1iMbHIearPGdkGemhQnSkl7a44zMDY,171
49
- python3_cyberfusion_queue_support-3.0.2.dist-info/top_level.txt,sha256=ss011q9S6SL_KIIyq7iujFmIYa0grSjlnInO7cDkeag,12
50
- python3_cyberfusion_queue_support-3.0.2.dist-info/RECORD,,
46
+ cyberfusion/QueueSupport/scripts/purge_queues.py,sha256=W1-p85YhAJhJfHIPQrS0KVgrLMzWPlGniDTZ_dSma_w,473
47
+ python3_cyberfusion_queue_support-3.1.dist-info/METADATA,sha256=Xkhtf7RojVQ83Vl1yd8dP4mbByKwSZ0N4_OvX4KnJXg,4619
48
+ python3_cyberfusion_queue_support-3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
49
+ python3_cyberfusion_queue_support-3.1.dist-info/entry_points.txt,sha256=z7WykKo9hbm5I1iMbHIearPGdkGemhQnSkl7a44zMDY,171
50
+ python3_cyberfusion_queue_support-3.1.dist-info/top_level.txt,sha256=ss011q9S6SL_KIIyq7iujFmIYa0grSjlnInO7cDkeag,12
51
+ python3_cyberfusion_queue_support-3.1.dist-info/RECORD,,