Skip to content

Commit

Permalink
receiver: removed state
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandromumo committed Jul 5, 2023
1 parent 2ad421a commit 1360d0f
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions invenio_github/receivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
RepositoryNotFoundError,
)

state = {}


class GitHubReceiver(Receiver):
"""Handle incoming notification from GitHub on a new release."""
Expand Down Expand Up @@ -72,11 +70,6 @@ def _handle_create_release(self, event):
"""Creates a release in invenio."""
try:
release_id = event.payload["release"]["id"]
if release_id in state:
raise ReleaseAlreadyReceivedError()

# Lock event release to avoid concurrent processing
state.update({release_id: event})

# Check if the release already exists
existing_release = Release.query.filter_by(
Expand Down Expand Up @@ -110,8 +103,6 @@ def _handle_create_release(self, event):
db.session.commit()
process_release.delay(release.release_id)

# Unlock the event release
del state[release_id]
except (ReleaseAlreadyReceivedError, RepositoryDisabledError) as e:
event.response_code = 409
event.response = dict(message=str(e), status=409)
Expand Down

0 comments on commit 1360d0f

Please sign in to comment.