Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silencing Connection Refused logs #404

Closed
MoreNaruto opened this issue May 6, 2022 · 3 comments
Closed

Silencing Connection Refused logs #404

MoreNaruto opened this issue May 6, 2022 · 3 comments

Comments

@MoreNaruto
Copy link

  • Which Faktory package and version? Faktory Enterprise 1.6.0
  • Which Faktory worker package and version? "github.com/contribsys/faktory_worker_go" 1.6.0
  • Please include any relevant worker configuration
  • Please include any relevant error messages or stacktraces

Are you using an old version?
Have you checked the changelogs to see if your issue has been fixed in a later version?

https://github.com/contribsys/faktory/blob/master/Changes.md
https://github.com/contribsys/faktory/blob/master/Pro-Changes.md
https://github.com/contribsys/faktory/blob/master/Ent-Changes.md

So whenever our faktory worker is down, the connection will constantly return this error. Is there a way to silence this particular log after the first failure? Or is there a way to have exponential retry logic to try to reconnect?

image

@mperham
Copy link
Collaborator

mperham commented May 6, 2022

This issue belongs in the contribsys/faktory_worker_go repo, as it's a worker issue. The code there is all open source. I'd welcome a PR if you have a specific fix in mind.

@MoreNaruto
Copy link
Author

So in this file: https://github.com/contribsys/faktory_worker_go/blob/main/runner.go

I'm going to replace L83-102 with:

//Implement exponential backoff for creating a process
	sleep := 1
	for i := 0; i < 10000; i++ {
		if mgr.state != "" {
			return
		}

		// check for shutdown
		select {
		case <-mgr.done:
			return
		default:
		}

		err := processOne(mgr)
		if err != nil {
			mgr.Logger.Debug(err)
			if _, ok := err.(*NoHandlerError); !ok {
				time.Sleep(1 * time.Second)
			}
		}
		time.Sleep(time.Duration(sleep) * time.Second)
		sleep *= 2
	}

There's a repo: github.com/cenkalti/backoff that can also do it, but I'm not sure what the rules are for incorporating new dependencies into your repo, so here's the boilerplate version.

I can't make a PR since I'm not a contributor. So can you add me as a contributor or is there another way you want me to create the PR?

@mperham
Copy link
Collaborator

mperham commented May 6, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants