Skip to content

Commit

Permalink
fix: refresh dimensions synchronously if dimensions to sync is specif…
Browse files Browse the repository at this point in the history
…ied (#634)
  • Loading branch information
1 parent 7d61044 commit 09329ad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/netsuite/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from .serializers import NetSuiteFieldSerializer, CustomSegmentSerializer
from .tasks import create_vendor_payment, check_netsuite_object_status, process_reimbursements
from .models import CustomSegment
from .helpers import check_interval_and_sync_dimension, sync_dimensions
from .helpers import check_interval_and_sync_dimension, handle_refresh_dimensions, sync_dimensions
from apps.workspaces.actions import export_to_netsuite

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -184,7 +184,11 @@ def post(self, request, *args, **kwargs):
workspace = Workspace.objects.get(pk=kwargs['workspace_id'])
NetSuiteCredentials.objects.get(workspace_id=workspace.id)

async_task('apps.netsuite.helpers.handle_refresh_dimensions', kwargs['workspace_id'], dimensions_to_sync)
# If only specified dimensions are to be synced, sync them synchronously
if dimensions_to_sync:
handle_refresh_dimensions(kwargs['workspace_id'], dimensions_to_sync)
else:
async_task('apps.netsuite.helpers.handle_refresh_dimensions', kwargs['workspace_id'], dimensions_to_sync)

return Response(
status=status.HTTP_200_OK
Expand Down

0 comments on commit 09329ad

Please sign in to comment.