Skip to content

Commit

Permalink
Introduce push_finished signal
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelGeo committed Nov 14, 2024
1 parent 916fb17 commit 2b8c382
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/mergin/sync/public_api_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
from .errors import StorageLimitHit
from ..utils import format_time_delta

push_triggered = signal("push_triggered")
push_finished = signal("push_triggered")
# TODO: Move to database events to handle all commits to project versions
project_version_created = signal("project_version_created")


Expand Down Expand Up @@ -732,7 +733,6 @@ def project_push(namespace, project_name):
if not ws:
abort(404)

push_triggered.send(project)
# fixme use get_latest
pv = ProjectVersion.query.filter_by(
project_id=project.id, name=project.latest_version
Expand Down Expand Up @@ -874,6 +874,7 @@ def project_push(namespace, project_name):
f"Transaction id: {upload.id}. No upload."
)
project_version_created.send(pv)
push_finished.send(pv)
return jsonify(ProjectSchema().dump(project)), 200
except IntegrityError as err:
db.session.rollback()
Expand Down Expand Up @@ -1084,6 +1085,7 @@ def push_finish(transaction_id):
f"Push finished for project: {project.id}, project version: {v_next_version}, transaction id: {transaction_id}."
)
project_version_created.send(pv)
push_finished.send(pv)
except (psycopg2.Error, FileNotFoundError, DataSyncError, IntegrityError) as err:
db.session.rollback()
logging.exception(
Expand Down

0 comments on commit 2b8c382

Please sign in to comment.