Skip to content

Commit

Permalink
Update shared + add signals related changes I forgot in previous PRs (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-codecov authored Aug 28, 2024
1 parent 612dd94 commit aea8367
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
9 changes: 8 additions & 1 deletion database/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ def _sync_repo(repository: Repository):
publisher = _get_pubsub_publisher()
topic_path = publisher.topic_path(pubsub_project_id, pubsub_topic_id)
publisher.publish(
topic_path, json.dumps({"sync": repository.repoid}).encode("utf-8")
topic_path,
json.dumps(
{
"type": "repo",
"sync": "one",
"id": repository.repoid,
}
).encode("utf-8"),
)
log.info(f"Message published for repository {repository.repoid}")
except Exception as e:
Expand Down
6 changes: 4 additions & 2 deletions database/tests/unit/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def test_shelter_repo_sync(dbsession, mock_configuration, mocker):
dbsession.commit()

publish.assert_called_once_with(
"projects/test-project-id/topics/test-topic-id", b'{"sync": 91728376}'
"projects/test-project-id/topics/test-topic-id",
b'{"type": "repo", "sync": "one", "id": 91728376}',
)

publish = mocker.patch("google.cloud.pubsub_v1.PublisherClient.publish")
Expand All @@ -37,5 +38,6 @@ def test_shelter_repo_sync(dbsession, mock_configuration, mocker):
dbsession.commit()

publish.assert_called_once_with(
"projects/test-project-id/topics/test-topic-id", b'{"sync": 91728376}'
"projects/test-project-id/topics/test-topic-id",
b'{"type": "repo", "sync": "one", "id": 91728376}',
)
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
https://github.com/codecov/opentelem-python/archive/refs/tags/v0.0.4a1.tar.gz#egg=codecovopentelem
https://github.com/codecov/shared/archive/dba67beec7c0ccc7cd3fe72409ef8767eb9c1c17.tar.gz#egg=shared
https://github.com/codecov/shared/archive/f9de90a4f65332893b0fc6ddda0d3d0c228d13e9.tar.gz#egg=shared
https://github.com/codecov/test-results-parser/archive/1507de2241601d678e514c08b38426e48bb6d47d.tar.gz#egg=test-results-parser
https://github.com/codecov/timestring/archive/d37ceacc5954dff3b5bd2f887936a98a668dda42.tar.gz#egg=timestring
asgiref>=3.7.2
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ sentry-sdk==1.40.0
# via
# -r requirements.in
# shared
shared @ https://github.com/codecov/shared/archive/dba67beec7c0ccc7cd3fe72409ef8767eb9c1c17.tar.gz
shared @ https://github.com/codecov/shared/archive/f9de90a4f65332893b0fc6ddda0d3d0c228d13e9.tar.gz
# via -r requirements.in
six==1.16.0
# via
Expand Down

0 comments on commit aea8367

Please sign in to comment.