Skip to content

Commit fb58daf

Browse files
committed
add delay between sounds
1 parent 4523ef2 commit fb58daf

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

.DS_Store

2 KB
Binary file not shown.

cmd/goose/.DS_Store

6 KB
Binary file not shown.

cmd/goose/main.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,28 @@ func (app *App) checkForNewlyBlockedPRs(ctx context.Context) {
708708
continue
709709
}
710710

711+
// If we already played the incoming sound (goose/honk), wait 2 seconds before playing outgoing sound (tada)
712+
if playedIncomingSound && !playedOutgoingSound {
713+
// Check if this PR would trigger a sound
714+
prevState, hasHistory := notificationHistory[pr.URL]
715+
var wouldPlaySound bool
716+
switch {
717+
case !hasHistory && isBlocked:
718+
wouldPlaySound = true
719+
case hasHistory && isBlocked && !prevState.WasBlocked:
720+
wouldPlaySound = true
721+
case hasHistory && isBlocked && prevState.WasBlocked && app.enableReminders && time.Since(prevState.LastNotified) > reminderInterval:
722+
wouldPlaySound = true
723+
default:
724+
wouldPlaySound = false
725+
}
726+
727+
if wouldPlaySound {
728+
log.Println("[SOUND] Delaying 2 seconds between goose and tada sounds")
729+
time.Sleep(2 * time.Second)
730+
}
731+
}
732+
711733
app.processPRNotifications(ctx, pr, isBlocked, false, notificationHistory,
712734
&playedOutgoingSound, now, reminderInterval)
713735
}

0 commit comments

Comments
 (0)