mirror of
https://github.com/grassrootseconomics/cic-custodial.git
synced 2024-11-29 08:56:45 +01:00
Mohammed Sohail
e203c49049
* 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
25 lines
488 B
Go
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,
|
|
)
|
|
}
|