Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix(integrations): send a single notification when a token refresh fails

Gilad Resisi178619d43b4f
diff --git a/libraries/nestjs-libraries/src/integrations/refresh.integration.service.ts b/libraries/nestjs-libraries/src/integrations/refresh.integration.service.ts
index 0689bdc60..bf59c32bb 100644
--- a/libraries/nestjs-libraries/src/integrations/refresh.integration.service.ts
+++ b/libraries/nestjs-libraries/src/integrations/refresh.integration.service.ts
@@ -78,6 +78,10 @@ export class RefreshIntegrationService {
.catch((err) => false);
if (!refresh || !refresh.accessToken) {
+ // informAboutRefreshError (with the failure cause) already notifies
+ // the user, and refreshNeeded sets the same flag disconnectChannel
+ // would β€” calling disconnectChannel here sent a second, cause-less
+ // copy of the same email for every failed refresh.
await this._integrationService.refreshNeeded(
integration.organizationId,
integration.id
@@ -89,11 +93,6 @@ export class RefreshIntegrationService {
cause
);
- await this._integrationService.disconnectChannel(
- integration.organizationId,
- integration
- );
-
return false;
}