mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-19 02:37:29 +08:00
fix: decouple weixin build helpers from whatsapp
This commit is contained in:
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user