Skip to content
New issue

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

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

Already on GitHub? # to your account

Default sync days setting #501

Merged
merged 6 commits into from
Aug 7, 2024
Merged

Default sync days setting #501

merged 6 commits into from
Aug 7, 2024

Conversation

adnanhashmi09
Copy link
Contributor

@adnanhashmi09 adnanhashmi09 commented Aug 7, 2024

Proposed changes (including videos or screenshots)

  • Made DEFAULT_SNC_DAYS_SETTINGS part of the settings module.
  • Now we wouldn't read the default sync days value from the env variable. Instead we save the default sync days in the database and get the value from there.
  • If value is not found in the database default value of 31 is used.
  • Necessary model, dataclasses and adapters were modified and created.
  • The usages were changed to include get_settings function from the settings service

Testing

  • The code was testing by calling the following API to save the DEFAULT_SYNC_DAYS_SETTING:
curl --location --request PUT 'http://localhost:9696/orgs/{org_id}/settings' \
--header 'Content-Type: application/json' \
--data '{
    "setting_type": "DEFAULT_SYNC_DAYS_SETTING",
    "setting_data": {"default_sync_days": 100}
}'
  • And then triggering the sync. The data was then verified to have been synced for past 100 days

Further comments

…r sync days instead of getting the value from the environment variable. Default sync days is set to be 31
This will be changed later once the functionalities depending on this
service reading the default sync days from envs are changed
@@ -54,9 +59,19 @@ def sync_org_incident_services(self, org_id: str):
LOG.error(f"Error syncing incident services for org {org_id}: {str(e)}")
return

def _sync_service_incidents(self, service: OrgIncidentService):
def _sync_service_incidents(self, org_id: str, service: OrgIncidentService):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we use service.org_id

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah good point. Thanks

@adnanhashmi09 adnanhashmi09 merged commit 7acfeec into main Aug 7, 2024
3 checks passed
@adnanhashmi09 adnanhashmi09 deleted the default-sync-days-setting branch August 7, 2024 18:13
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants