kast0l Posted February 16 Report Posted February 16 console output: Login: starlivovsky5 completed successfully Total accounts connected: 1 from 1 All accounts are successfully connected. Process Node.js ended with code 0 Function execution time: 10.006s PS C:\Users\Kast0l\Desktop\tetst script> Please help me solve this problem or at least understand what it is const SteamUser = require("steam-user"); const SteamTotp = require("steam-totp"); const accounts = require("./accounts.js"); let totalConnectedAccounts = 0; const logInAccounts = async () => { for (let account of accounts) { const client = new SteamUser const logInOptions = { accountName: account.accountName, password: account.password, twoFactorCode: SteamTotp.generateAuthCode(account.sharedSecret) }; try { await new Promise((resolve, reject) => { client.logOn(logInOptions); client.once("loggedOn", () => { totalConnectedAccounts++; console.log(`Login: ${account.accountName} completed successfully`); resolve(); }); client.once("error", (err) => { console.log(`Ошибка при входе для аккаунта ${account.accountName}: ${err}`); reject(err); }); }); } finally { await client.logOff(); } } console.log(`\nTotal accounts connected: ${totalConnectedAccounts} from ${accounts.length}`); console.log("All accounts are successfully connected."); console.time("Function execution time"); process.on('exit', (code) => { console.log(`Process Node.js ended with code ${code}`); console.timeEnd("Function execution time"); }); }; logInAccounts() Quote
kast0l Posted February 16 Author Report Posted February 16 After all the code was executed, I noticed that the command line was being entered with a delay, I decided to measure the time and it turned out that Node.js terminates only after a fixed time of 10 seconds has elapsed Quote
Dr. McKay Posted February 16 Report Posted February 16 If there's a request outstanding when you call logOff(), it has to wait for the request to timeout before the Node.js process can exit. There's a bunch of requests that get made internally when you first log on; you're better off waiting a second or so after loggedOn is emitted before calling logOff(). In the future I'll try to add a mechanism to cancel outstanding requests when we log off, but it's not quite as simple as it first sounds. Quote
kast0l Posted February 16 Author Report Posted February 16 (edited) Thanks for the answer Edited February 16 by kast0l Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.