待机配置
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user