Skip to content

Commit

Permalink
Fix: Import Cluster Schedules (#308)
Browse files Browse the repository at this point in the history
* Fix: Import Cluster Schedules

* Comments Fixed
  • Loading branch information
ruuushhh authored Feb 20, 2024
1 parent 8d581ff commit c7610e1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion apps/mappings/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def schedule_or_delete_fyle_import_tasks(configuration: WorkspaceGeneralSettings
start_datetime = datetime.now()
Schedule.objects.update_or_create(
func="apps.mappings.tasks.auto_import_and_map_fyle_fields",
cluster="import",
cluster='import',
args="{}".format(configuration.workspace_id),
defaults={
"schedule_type": Schedule.MINUTES,
Expand Down
8 changes: 4 additions & 4 deletions apps/mappings/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def schedule_auto_map_employees(employee_mapping_preference: str, workspace_id:
if employee_mapping_preference:
Schedule.objects.update_or_create(
func="apps.mappings.tasks.async_auto_map_employees",
cluster="import",
cluster='import',
args="{}".format(workspace_id),
defaults={
"schedule_type": Schedule.MINUTES,
Expand All @@ -30,7 +30,7 @@ def schedule_cost_centers_creation(import_to_fyle, workspace_id: int):
if import_to_fyle:
schedule, _ = Schedule.objects.update_or_create(
func="apps.mappings.tasks.auto_create_cost_center_mappings",
cluster="import",
cluster='import',
args="{}".format(workspace_id),
defaults={
"schedule_type": Schedule.MINUTES,
Expand All @@ -52,7 +52,7 @@ def schedule_tax_groups_creation(import_tax_codes, workspace_id):
if import_tax_codes:
schedule, _ = Schedule.objects.update_or_create(
func="apps.mappings.tasks.auto_create_tax_codes_mappings",
cluster="import",
cluster='import',
args="{}".format(workspace_id),
defaults={
"schedule_type": Schedule.MINUTES,
Expand All @@ -78,7 +78,7 @@ def schedule_fyle_attributes_creation(workspace_id: int):
if mapping_settings:
schedule, _ = Schedule.objects.get_or_create(
func="apps.mappings.tasks.async_auto_create_custom_field_mappings",
cluster="import",
cluster='import',
args="{0}".format(workspace_id),
defaults={
"schedule_type": Schedule.MINUTES,
Expand Down
5 changes: 1 addition & 4 deletions apps/workspaces/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ def post_workspace(access_token, request):
async_task(
"apps.workspaces.tasks.async_add_admins_to_workspace",
workspace.id,
request.user.user_id,
q_options={
'cluster': 'import'
}
request.user.user_id
)

return workspace
Expand Down
2 changes: 1 addition & 1 deletion apps/workspaces/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def schedule_email_notification(workspace_id: int, schedule_enabled: bool, hours
schedule, _ = Schedule.objects.update_or_create(
func="apps.workspaces.tasks.run_email_notification",
args="{}".format(workspace_id),
cluster="import",
cluster='import',
defaults={
"schedule_type": Schedule.MINUTES,
"minutes": hours * 60,
Expand Down
4 changes: 2 additions & 2 deletions fyle_xero_api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@
"max_rss": 100000, # 100mb
'ALT_CLUSTERS': {
'import': {
"retry": 14400,
"timeout": 3600
'retry': 14400,
'timeout': 3600
},
}
}
Expand Down
4 changes: 2 additions & 2 deletions fyle_xero_api/tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@
"max_rss": 100000, # 100mb
'ALT_CLUSTERS': {
'import': {
"retry": 14400,
"timeout": 3600
'retry': 14400,
'timeout': 3600
},
}
}
Expand Down

0 comments on commit c7610e1

Please sign in to comment.