fix: decouple weixin build helpers from whatsapp

This commit is contained in:
lpf
2026-03-24 10:34:39 +08:00
parent 8e2bf3c492
commit 731fc9c99c
2 changed files with 12 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ import (
"context" "context"
"errors" "errors"
"sync" "sync"
"time"
"github.com/YspCoder/clawgo/pkg/logger" "github.com/YspCoder/clawgo/pkg/logger"
) )
@@ -59,3 +60,14 @@ func runChannelTask(name, taskName string, task func() error, onFailure func(err
} }
}() }()
} }
func sleepWithContext(ctx context.Context, d time.Duration) bool {
timer := time.NewTimer(d)
defer timer.Stop()
select {
case <-ctx.Done():
return false
case <-timer.C:
return true
}
}

View File

@@ -287,14 +287,3 @@ func nextBackoff(current, max time.Duration) time.Duration {
} }
return next return next
} }
func sleepWithContext(ctx context.Context, d time.Duration) bool {
timer := time.NewTimer(d)
defer timer.Stop()
select {
case <-ctx.Done():
return false
case <-timer.C:
return true
}
}