Skip to content

Commit

Permalink
Feature/remove rest client from celery (#727)
Browse files Browse the repository at this point in the history
* feat: update list_project_organization endpoint removing the celery call

* feat: update all code that called celery tasks for communicating with connect to calls directly into ConnectRESTClient

* bugfix: remove task.result after condition to user or not grpc endpoints, as it was conflicting with the rest call
  • Loading branch information
helllllllder committed Jul 21, 2022
1 parent 4aa9fe2 commit e54bdc0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bothub/api/v2/repository/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ def projectrepository(self, request, **kwargs):
name="get_project_organization", args=[project_uuid]
)
task.wait()

repositories = repository.authorizations.filter(uuid__in=task.result)
authorizations = task.result
repositories = repository.authorizations.filter(uuid__in=authorizations)

else:
authorizations = ConnectClient().list_authorizations(
Expand All @@ -272,7 +272,7 @@ def projectrepository(self, request, **kwargs):
if organization:

organization_authorization = (
organization.organization_authorizations.filter(uuid__in=task.result)
organization.organization_authorizations.filter(uuid__in=authorizations)
)
data["in_project"] = (
data["in_project"] or organization_authorization.exists()
Expand Down Expand Up @@ -317,10 +317,10 @@ def remove_repository_project(self, request, **kwargs):
name="get_project_organization", args=[project_uuid]
)
project_organization.wait()

project_organization = project_organization.result
authorizations = list(
repository.authorizations.filter(
uuid__in=project_organization.result
uuid__in=project_organization
).values_list("uuid", flat=True)
)

Expand All @@ -343,7 +343,7 @@ def remove_repository_project(self, request, **kwargs):

authorizations += list(
organization.organization_authorizations.filter(
uuid__in=project_organization.result
uuid__in=project_organization
).values_list("uuid", flat=True)
)

Expand Down

0 comments on commit e54bdc0

Please sign in to comment.