2
0
mirror of https://github.com/hibiken/asynq.git synced 2026-05-05 07:36:25 +08:00

[RFC] Adds Ping() to client/scheduler/server (#585)

* [RFC] Adds Ping() to client/scheduler/server

* Checks for scheduler state closed
This commit is contained in:
Patrick Barnum
2024-10-18 23:44:06 -07:00
committed by GitHub
parent 0dc670d7d8
commit b1e13893ff
3 changed files with 30 additions and 1 deletions

View File

@@ -419,6 +419,11 @@ func (c *Client) EnqueueContext(ctx context.Context, task *Task, opts ...Option)
return newTaskInfo(msg, state, opt.processAt, nil), nil
}
// Ping performs a ping against the redis connection.
func (c *Client) Ping() error {
return c.broker.Ping()
}
func (c *Client) enqueue(ctx context.Context, msg *base.TaskMessage, uniqueTTL time.Duration) error {
if uniqueTTL > 0 {
return c.broker.EnqueueUnique(ctx, msg, uniqueTTL)