Jump to content
McKay Development

Recommended Posts

Posted

hi i am facing code crashes on a few occasion for example when the steamcommunity has a 503 error means their server is down or when the steam user request time outs the problem is that it is inherent to the libraries once these occur the whole code crashes isnt it should have a backoff or retry mechanism? instead of the throwing of error whats teh fix to this?
 

\node_modules\steam-user\node_modules\@doctormckay\stdlib\lib\promises\timeoutPromise.js:12
    let err = new Error('Request timed out');
              ^

Error: Request timed out
    at timeoutPromise (C:\Autoconfirmbot\node_modules\steam-user\node_modules\@doctormckay\stdlib\lib\promises\timeoutPromise.js:12:15)
    at HttpClient.request (C:\Autoconfirmbot\node_modules\steam-user\node_modules\@doctormckay\stdlib\lib\http\client\HttpClient.js:63:46)
    at SteamUser._apiRequest (C:\Autoconfirmbot\node_modules\steam-user\components\06-webapi.js:60:26)
    at SteamUser._doConnection (C:\Autoconfirmbot\node_modules\steam-user\components\09-logon.js:296:32)
    at Timeout._onTimeout (C:\Autoconfirmbot\node_modules\steam-user\components\09-logon.js:311:27)
    at listOnTimeout (node:internal/timers:573:17)
    at process.processTimers (node:internal/timers:514:7)
Emitted 'error' event on SteamUser instance at:
    at SteamUser._doConnection (C:\Autoconfirmbot\node_modules\steam-user\components\09-logon.js:309:10)
    at runNextTicks (node:internal/process/task_queues:60:5)
    at listOnTimeout (node:internal/timers:540:9)
    at process.processTimers (node:internal/timers:514:7)

Posted

Your app has crashed because you aren't listening for the error event. Every Node.js EventEmitter crashes the app if an unhandled error event is emitted.

The error in question is raised when steam-user fails to retrieve the Steam server list from the WebAPI after 10 retries.

  • 4 weeks later...
Posted (edited)
On 7/6/2024 at 1:15 AM, Dr. McKay said:

Your app has crashed because you aren't listening for the error event. Every Node.js EventEmitter crashes the app if an unhandled error event is emitted.

The error in question is raised when steam-user fails to retrieve the Steam server list from the WebAPI after 10 retries.

ok so i am currently listening for the error event this is the code that i wrote to listen it 
so i purpose fully disconnetcted my internet when the app was running  and i got this 

The error Created by the error event incase djfdsjfbsdjgfnbsdjgsngjsgjs Error: connect EHOSTUNREACH 192.144.11.39:30013
i was expecting a enum that i could pass into the erusult in this case when i was logging err.eresult i was getting undefined and i dont exacly know what u mean by handling the upper situation happens or the internet is dced what should i do to not crash it reinitialize everything after a sleep item ?

    client.on('error',async(err)=>{
        //SteamUser.EResult[err]
      console.log(`The error Created by the error event incase djfdsjfbsdjgfnbsdjgsngjsgjs ${err}`)
    });
 
 
 
Edited by TheMaster
Posted

It's not mentioned in the documentation, but you only get an eresult in the error event if a Steam connection can actually be established. If you don't have an eresult proeprty, you can assume there was a network issue.

15 hours ago, TheMaster said:

i dont exacly know what u mean by handling the upper situation happens or the internet is dced what should i do to not crash it reinitialize everything after a sleep item ?

Only you can properly decide the best course of action for your app, but if your network is down then yeah, probably all you can do is wait and retry until the network comes up.

Posted
On 7/6/2024 at 1:15 AM, Dr. McKay said:

Your app has crashed because you aren't listening for the error event. Every Node.js EventEmitter crashes the app if an unhandled error event is emitted.

The error in question is raised when steam-user fails to retrieve the Steam server list from the WebAPI after 10 retries.

the main question was this if happens a lot and it causes the program to crash how can i reinitialize the process of retrieving the steam server list from the webapi idk if its even possible whats the fix to this? 
Thanks for your previous reply  

Posted
1 hour ago, Dr. McKay said:

Catch the error event to prevent the crash, and call logOn again to kick off trying to connect.

so this is what i did as there is no enum for Request Timed Out in the eresult you donot need to reply to this if its al right u can just react to it to let me know its fine
 

    client.on('error',async(err)=>{
        //SteamUser.EResult[err]
      if(err.message==="Request timed out"){
        client.logOn(logOnOptions);
      }
      console.log(`The error Created by the error event incase djfdsjfbsdjgfnbsdjgsngjsgjs ${err}`)
    });
Posted
12 hours ago, Dr. McKay said:

You'd want to call logOn for any error event, likely after a delay.

ok so here is what i have thought listen for all error and as the documentation says that the client.steamID is redifined everytime the error event is called if the steam id is not found i.e. if(!client.steamID) i put a exponential backup algorithm to call logon in this way all the possible errors will be covered regarding the steam disconnection and i will put a 10s delay in calling the logon first time 
Sounds like a good plan?

Posted
12 hours ago, Dr. McKay said:

Sure

ok so i have done the following the probably last question i have is as there is too much happening in app i may have over looked something 
 

    client.on('error',async(err)=>{
        //SteamUser.EResult[err]
      if(err){
        await helpers.sleep(10000)
        if(!client.steamID){
            client.logOn(logOnOptions);
        }
      }
      console.log(`The error Created by the error event incase djfdsjfbsdjgfnbsdjgsngjsgjs ${err}`)
    });
So the question i have is How can i know because there is no callback ok logON() that my log on was successful should i set up a loop inside the error event while i am calling the logon to continous check for steam id and call log on with a delay  i think this is where the exponential backoff kicks in 
Posted
On 8/3/2024 at 9:37 AM, Dr. McKay said:

If log on succeeds, you get a loggedOn event. Check the example scripts in the GitHub repo.

yeah i have made a switch mechanism using that thanks for reminding me that was a thing i have set it up earlier but never used it in anyway other than showing that my accountwas logged i see a dm feature on this platfrom do u reply to dms?

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...