Skip to content

Commit

Permalink
linters
Browse files Browse the repository at this point in the history
  • Loading branch information
meln1k committed Oct 22, 2024
1 parent 1b5ce12 commit 8a0986d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 6 additions & 2 deletions fixbackend/cloud_accounts/azure_subscription_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,15 @@ async def get_by_tenant(self, tenant_id: WorkspaceId) -> Optional[AzureSubscript

return entity.to_model()

async def list_created_after(self, time: datetime, can_access_azure_account: Optional[bool] = None) -> List[AzureSubscriptionCredentials]:
async def list_created_after(
self, time: datetime, can_access_azure_account: Optional[bool] = None
) -> List[AzureSubscriptionCredentials]:
async with self._session_maker() as session:
filters = [AzureSubscriptionCredentialsEntity.created_at > time]
if can_access_azure_account is not None:
filters.append(AzureSubscriptionCredentialsEntity.can_access_azure_account.is_(can_access_azure_account))
filters.append(
AzureSubscriptionCredentialsEntity.can_access_azure_account.is_(can_access_azure_account)
)
query = select(AzureSubscriptionCredentialsEntity).filter(*filters)
result = await session.execute(query)
return [entity.to_model() for entity in result.scalars()]
Expand Down
3 changes: 1 addition & 2 deletions fixbackend/cloud_accounts/azure_subscription_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ async def _import_subscriptions(self, creds: AzureSubscriptionCredentials) -> No

async def _ping_new_subscriptions(self) -> None:
created_less_than_30_minutes_ago = await self.azure_subscriptions_repo.list_created_after(
utc() - timedelta(minutes=30),
can_access_azure_account=False
utc() - timedelta(minutes=30), can_access_azure_account=False
)

async with asyncio.TaskGroup() as tg:
Expand Down

0 comments on commit 8a0986d

Please sign in to comment.