Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tasks): Create a different task to update environment document #2807

Merged
merged 5 commits into from
Oct 5, 2023

Conversation

gagantrivedi
Copy link
Member

@gagantrivedi gagantrivedi commented Sep 27, 2023

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Create a different task for updating environment document and sending SSE message in order to reduce the transaction length (earlier it was doing all of the above as well in the same transaction)

How did you test this code?

Adds unit tests

@vercel
Copy link

vercel bot commented Sep 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 28, 2023 6:27am
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 28, 2023 6:27am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 28, 2023 6:27am

@github-actions
Copy link
Contributor

github-actions bot commented Sep 27, 2023

Uffizzi Preview deployment-36926 was deleted.

@codecov-commenter
Copy link

codecov-commenter commented Sep 27, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (fce2e3a) 95.53% compared to head (56d7594) 95.53%.
Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2807   +/-   ##
=======================================
  Coverage   95.53%   95.53%           
=======================================
  Files         994      994           
  Lines       28072    28074    +2     
=======================================
+ Hits        26818    26820    +2     
  Misses       1254     1254           
Files Coverage Δ
api/audit/models.py 100.00% <100.00%> (ø)
api/environments/tasks.py 100.00% <100.00%> (ø)
api/tests/unit/audit/test_unit_audit_models.py 98.52% <100.00%> (-0.26%) ⬇️
...s/unit/environments/test_unit_environment_tasks.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gagantrivedi gagantrivedi changed the title refac(tasks): Create a different task to update environment document refactor(tasks): Create a different task to update environment document Sep 27, 2023
@gagantrivedi gagantrivedi marked this pull request as ready for review September 27, 2023 05:16
@gagantrivedi gagantrivedi requested review from a team and khvn26 September 27, 2023 05:17
Copy link
Contributor

@matthewelwell matthewelwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One fairly minor comment, otherwise this looks good to me.

self.update_environments_updated_at()
self.send_environments_to_dynamodb()
self.send_environment_update_message()

def update_environments_updated_at(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method feels like it could be named better since it's triggering another task to handle the environment update logic. It might also benefit from a docstring I guess?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it does update the updated_at

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I can change it back to process_environment_update

@gagantrivedi gagantrivedi changed the title refactor(tasks): Create a different task to update environment document fix(tasks): Create a different task to update environment document Oct 5, 2023
@gagantrivedi gagantrivedi merged commit ab21983 into main Oct 5, 2023
@gagantrivedi gagantrivedi deleted the refactor/shorter-transactions branch October 5, 2023 08:07
@sentry-io
Copy link

sentry-io bot commented Oct 5, 2023

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ AuditLog.DoesNotExist: AuditLog matching query does not exist. environments.tasks in process_environment_update View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants