cic-custodial/internal/tasker/task/utils.go
Mohammed Sohail e203c49049
major refactor: use proxy contract and gas faucet (see notes)
* remove uncessary tasks and task handlers
* reafctor custodial container
* refactor gas refiller. Gas refiller can queue at a later time to match cooldown
* refactor sub handler to process chain events
2023-03-29 16:10:58 +00:00

25 lines
488 B
Go

package task
import (
"time"
"github.com/bsm/redislock"
)
const (
gasLimit = 250000
lockPrefix = "lock:"
lockRetryDelay = 25 * time.Millisecond
lockTimeout = 1 * time.Second
)
// lockRetry will at most try to obtain the lock 20 times within ~0.5s.
// it is expected to prevent immidiate requeue of the task at the expense of more redis calls.
func lockRetry() redislock.RetryStrategy {
return redislock.LimitRetry(
redislock.LinearBackoff(lockRetryDelay),
20,
)
}