待机配置

This commit is contained in:
2024-11-05 18:39:03 +08:00
parent ccfe0d311b
commit 8e2bf7f59b
15 changed files with 384 additions and 132 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"github.com/eclipse/paho.golang/paho"
"math"
"time"
)
// abortIndex represents a typical value used in abort functions.
@@ -132,3 +133,9 @@ func WithCancel(ctx *Context) context.CancelFunc {
ctx.Context = c
return cancel
}
func WithDeadline(ctx *Context, t time.Time) context.CancelFunc {
c, cancel := context.WithDeadline(ctx.Context, t)
ctx.Context = c
return cancel
}