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

bug: maxRetries will always try at least twice #640

Open
dgibbs64 opened this issue Sep 18, 2024 · 3 comments
Open

bug: maxRetries will always try at least twice #640

dgibbs64 opened this issue Sep 18, 2024 · 3 comments
Labels

Comments

@dgibbs64
Copy link
Contributor

Describe the bug
When I set maxRetries to 1 or 0 gamedig will still retry at least twice sometimes 3 times.

Steps To Reproduce
set maxRetries to 1 or 0 and see at least 2 failed attempts

Expected behavior
gamedig should try only once

        const gamedigData = await GameDig.query({
          type: protocol,
          host: ip,
          port: portToTry,
          requestRules: true,
          maxRetries: 1,
          socketTimeout: 750,
        });

Error: Failed all 3 attempts

@dgibbs64 dgibbs64 added the bug label Sep 18, 2024
@mmorrisontx
Copy link
Member

For some reason, in v5, maxAttempts was renamed to maxRetries, but the behaviour wasn't changed, so maxRetries still really means maxTries. If you could set it to 0 (which you can't) it wouldn't try the query at all.

Note that the number of attempts is not the same as the number of tries. One try may contain three attempts if it has to try three different ports.

@cetteup
Copy link
Contributor

cetteup commented Sep 19, 2024

The later part can be addressed by using the givenPortOnly option, which I would highly recommend if you know the correct port or implemented you own "ports to try" logic outside of gamedig.

@dgibbs64
Copy link
Contributor Author

I think slightly modifying the log output to clarify what it has done might save any misunderstanding. Something like Error: Failed all 1 attempts with 2 ports tried might be a good idea.

@dgibbs64 dgibbs64 changed the title bug: maxRetries will always try at lease twice bug: maxRetries will always try at least twice Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants