This commit is contained in:
Hymmel 2025-10-14 10:55:39 +02:00
parent 98e8beff1a
commit 0e3f2aba11

View file

@ -83,12 +83,16 @@ func (j *ClanMonitorJob) Run(ctx context.Context) error {
}
if len(members) == 0 {
log.Printf("clan monitor: no members returned for clan %s", j.clanTag)
return nil
}
log.Printf("clan monitor: fetched %d members for clan %s", len(members), j.clanTag)
var inactive []inactiveMember
for _, member := range members {
if member.LastSeen.IsZero() {
log.Printf("clan monitor: missing lastSeen for %s (%s); skipping", member.Name, member.Tag)
continue
}
@ -102,6 +106,7 @@ func (j *ClanMonitorJob) Run(ctx context.Context) error {
}
if len(inactive) == 0 {
log.Printf("clan monitor: no members inactive ≥ %s", formatDuration(offlineThreshold))
return nil
}
@ -114,6 +119,7 @@ func (j *ClanMonitorJob) Run(ctx context.Context) error {
var newlyInactive []inactiveMember
for _, member := range inactive {
if _, alreadyNotified := j.notified[member.Tag]; alreadyNotified {
log.Printf("clan monitor: already notified inactivity for %s (%s); skipping DM", member.Name, member.Tag)
continue
}
@ -123,6 +129,7 @@ func (j *ClanMonitorJob) Run(ctx context.Context) error {
}
if len(newlyInactive) == 0 {
log.Printf("clan monitor: no new inactive members to notify (all %d already handled)", len(inactive))
return nil
}