Skip to content

Is there any way to write clean up hook after max retries? #545

@adiatma85

Description

@adiatma85

This is just simple issue I had in mind. In my usecases, every time I retry, I change the entry in my databases to indicate how many retry in there. This case, is could be solved by using OnRetryHook on the Retry Middleware.

In my usecases, when the retry is at max limit, I want to do an action to do something (i.e notify me to Discord or anythings). What I had in mind was this....

type Retry struct {
       // All the atributes goes in here....
 
	// OnRetryHook is an optional function that will be executed on each retry attempt.
	// The number of the current retry is passed as retryNum,
	OnRetryHook func(retryNum int, delay time.Duration)

        OnCleanUpHook func(msg *message.Message) // something like this
}

Is there any better way to do this or the package has built-in function to solve this?
Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions