-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into 15959
- Loading branch information
Showing
34 changed files
with
317 additions
and
53 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
auth-api/migrations/versions/2024_05_15_b3a741249edc_duplicate_queue_messages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""Add in new table for account mailer for pubsub message processing. | ||
Revision ID: b3a741249edc | ||
Revises: e2d1d6417607 | ||
Create Date: 2024-05-15 14:52:45.780399 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'b3a741249edc' | ||
down_revision = 'e2d1d6417607' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.create_table('pubsub_message_processing', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('cloud_event_id', sa.String(length=250), nullable=False), | ||
sa.Column('created', sa.DateTime(), nullable=True), | ||
sa.Column('message_type', sa.String(length=250), nullable=False), | ||
sa.Column('processed', sa.DateTime(), nullable=True), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_index(op.f('ix_pubsub_message_processing_id'), 'pubsub_message_processing', ['id'], unique=False) | ||
|
||
|
||
def downgrade(): | ||
op.drop_index(op.f('ix_pubsub_message_processing_id'), table_name='pubsub_message_processing') | ||
op.drop_table('pubsub_message_processing') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""This model manages pubsub message processing. | ||
NOTE: Only use this when it's not possible to use other indicators to track message processing. | ||
Currently used by the account-mailer / auth-queue. This prevents duplicates. | ||
""" | ||
import datetime as dt | ||
import pytz | ||
|
||
from sqlalchemy import Column, DateTime, Integer, String | ||
from .db import db | ||
|
||
|
||
class PubSubMessageProcessing(db.Model): | ||
"""PubSub Message Processing for cloud event messages.""" | ||
|
||
__tablename__ = 'pubsub_message_processing' | ||
|
||
id = Column(Integer, index=True, primary_key=True) | ||
cloud_event_id = Column(String(250), nullable=False) | ||
created = Column(DateTime, default=dt.datetime.now(pytz.utc)) | ||
message_type = Column(String(250), nullable=False) | ||
processed = Column(DateTime, nullable=True) | ||
|
||
@classmethod | ||
def find_by_id(cls, identifier): | ||
"""Find a pubsub message processing by id.""" | ||
return cls.query.filter_by(id=identifier).one_or_none() | ||
|
||
@classmethod | ||
def find_by_cloud_event_id_and_type(cls, cloud_event_id, message_type): | ||
"""Find a pubsub message processing for cloud event id and type.""" | ||
return cls.query.filter_by(cloud_event_id=cloud_event_id, message_type=message_type).one_or_none() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.