2026-03-17 11:31:59 +08:00
|
|
|
package delayqueue
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"log/slog"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/redis/go-redis/v9"
|
|
|
|
|
|
|
|
|
|
"github.com/chaitin/MonkeyCode/backend/domain"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// VMExpireQueue VM 过期队列
|
|
|
|
|
type VMExpireQueue struct {
|
|
|
|
|
*RedisDelayQueue[*domain.VmExpireInfo]
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-19 22:10:56 +08:00
|
|
|
func NewVMExpireQueue(rdb *redis.Client, logger *slog.Logger) *VMExpireQueue {
|
2026-03-25 21:14:14 +08:00
|
|
|
return &VMExpireQueue{NewRedisDelayQueue(rdb, logger,
|
2026-03-17 11:31:59 +08:00
|
|
|
WithPrefix[*domain.VmExpireInfo]("mcai:vmexpire"),
|
|
|
|
|
WithPollInterval[*domain.VmExpireInfo](5*time.Second),
|
2026-03-19 22:10:56 +08:00
|
|
|
WithRequeueDelay[*domain.VmExpireInfo](1*time.Minute),
|
|
|
|
|
)}
|
2026-03-17 11:31:59 +08:00
|
|
|
}
|