Skip to content

Commit

Permalink
refactor(services/misc): do not declare separate integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Feb 10, 2025
1 parent 546e73f commit 006abae
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions crates/services/miscellaneous/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2598,17 +2598,16 @@ ORDER BY RANDOM() LIMIT 10;
.all(&self.0.db)
.await?;
let mut integrations_to_disable = vec![];
for integration in integrations {
let mut first_five = integration.trigger_result.iter().take(5);
let are_all_errors = first_five.all(|r| r.error.is_some());
for int in integrations {
let are_all_errors = int.trigger_result.iter().take(5).all(|r| r.error.is_some());
if are_all_errors {
integrations_to_disable.push(integration.id);
integrations_to_disable.push(int.id);
create_notification_for_user(
&integration.user_id,
&int.user_id,
&(
format!(
"Integration {} has been disabled due to too many errors",
integration.provider
int.provider
),
UserNotificationContent::IntegrationDisabledDueToTooManyErrors,
),
Expand Down

0 comments on commit 006abae

Please sign in to comment.