TikTok-Api icon indicating copy to clipboard operation
TikTok-Api copied to clipboard

fix: playwright timeout sessions with provide opt-out params

Open arhen opened this issue 5 months ago • 0 comments

So, this PR is to provide opt-out solution for issues; #1185 and #994

PROBLEMS

when I try to figure out what is happening, most of the time the sessions is not long enough to handle the navigation process. This issue appear due to some problems such as; lack of resources when run the script, too much sessions to handle (ex: run alot of script once in a time), and another process block the session to finish.

SOLUTION

By default, playwright timeout sessions is 3000ms == 30 seconds. For those problems above, this default timeouts is not enough. So with opt-out the timeout params via creating session , we can override default playwright timeout sessions before navigation started.

IMPLEMENTATION

This PR basically adding opt-out params when creating session. ex:

await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3, timeout=60000)

this will let playwirght session started with 60secs timeout instead of 30s by default.

arhen avatar Sep 22 '24 09:09 arhen