Only notify segment changes when amount has changed

This commit is contained in:
Dries Augustyns
2025-12-08 09:26:36 +01:00
parent 82e846e993
commit 6746d9e843
2 changed files with 70 additions and 71 deletions
+10 -3
View File
@@ -44,9 +44,16 @@ async function processProjectSegments(projectId: string, projectName?: string):
`[SEGMENT-COUNT-WORKER] Segment "${segment.name}": +${result.added} entries, -${result.removed} exits, ${result.total} total members`,
);
// Notify about segment membership update (only for tracked segments)
if (projectName) {
await NtfyService.notifySegmentMembershipComputed(segment.name, projectName, projectId, result.total);
// Notify about segment membership update only if there were actual changes
if (projectName && (result.added > 0 || result.removed > 0)) {
await NtfyService.notifySegmentMembershipComputed(
segment.name,
projectName,
projectId,
result.total,
result.added,
result.removed,
);
}
} catch (error) {
signale.error(`[SEGMENT-COUNT-WORKER] Failed to compute membership for segment ${segment.id}:`, error);