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

mwn.init - defaultParams.assert overrides maxRetries and crashes on encountering maxlag #86

Open
Ivi104 opened this issue Dec 4, 2024 · 0 comments

Comments

@Ivi104
Copy link

Ivi104 commented Dec 4, 2024

Steps to reproduce:

  • Initialize the bot with mwn.init, and use a BotPassword
  • add defaultParams: { assert: 'user' } (as described in mwn.readthedocs.io)
  • attempt to login with client.getSiteInfo()
  • The wiki sends a high maxlag value

Current behavior:

  • the bot attempts to login, receives maxlag, waits 5 seconds, assertUser fails, and the bot tries to login again.
  • This cycle will continue infinitely (ignoring maxRetries), until maxlag clears and the bot manages to login, at which point it will crash with message "already logged in".

Expected behavior:

  • it should respect maxRetries, and attempt to login only 3 times by default.
  • assertuserfailed should not reset the maxRetries counter
  • When maxlag clears it should not crash after successfully logging in.

See log below:

Encountered maxlag: 9.437752 seconds lagged. Waiting for 5 seconds before retrying
[2024-12-04 21:10:08] [W] Received assertuserfailed, attempting to log in and retry
[2024-12-04 21:10:08] [W] Encountered maxlag: 12.360417 seconds lagged. Waiting for 5 seconds before retrying
[2024-12-04 21:10:13] [W] Received assertuserfailed, attempting to log in and retry
[2024-12-04 21:10:13] [W] Encountered maxlag: 10.485554 seconds lagged. Waiting for 5 seconds before retrying
[2024-12-04 21:10:18] [W] Received assertuserfailed, attempting to log in and retry
[2024-12-04 21:10:18] [W] Encountered maxlag: 9.296703 seconds lagged. Waiting for 5 seconds before retrying
[2024-12-04 21:10:23] [W] Received assertuserfailed, attempting to log in and retry
[2024-12-04 21:10:25] [S] [mwn] Login successful: [REDACTED]
[REDACTED]/node_modules/mwn/build/error.js:43
return Promise.reject(new MwnError(errorConfig));
^

MwnError: Already logged in as [REDACTED], logout first to re-login
at Object.rejectWithError ([REDACTED]/node_modules/mwn/build/error.js:43:27)
at mwn.login ([REDACTED]/node_modules/mwn/build/bot.js:443:24)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Response.process ([REDACTED]/node_modules/mwn/build/core.js:185:17)
at async Response.process ([REDACTED]/node_modules/mwn/build/core.js:185:17)
at async mwn.login ([REDACTED]/node_modules/mwn/build/bot.js:388:36)
at async Response.process ([REDACTED]/node_modules/mwn/build/core.js:185:17)
at async Response.process ([REDACTED]/node_modules/mwn/build/core.js:185:17)
at async mwn.login ([REDACTED]/node_modules/mwn/build/bot.js:388:36) {
code: 'mwn_failedlogin',
info: 'Already logged in as [REDACTED], logout first to re-login',
response: {
login: {
result: 'Aborted',
reason: 'Cannot log in when using MediaWiki\Session\BotPasswordSessionProvider sessions.'
}
}
}

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

1 participant