mattsse / chromiumoxide

Chrome Devtools Protocol rust API
Apache License 2.0
712 stars 69 forks source link

Unable to configure timeout on commands #175

Open ccapitalKW opened 9 months ago

ccapitalKW commented 9 months ago

Hello,

I am attempting to use this library to trigger a heap snapshot in chrome. There is a hardcoded timeout of 30 seconds built in to the library, which gets exceeded by the heap snapshot command if the tab being snapshot-ed is too large (in the order of 10s of millions of heap objects). I don't see any way to configure the timeout for a command in the API provided by this crate, I am currently working around it by bumping the limit in a fork of the repo. Is there a better way to do this?

Thank you in advance.

mattsse commented 9 months ago

supportive of making this configurable, happy to accept a pr for that

ccapitalKW commented 9 months ago

I guess this is already partially solved by https://github.com/mattsse/chromiumoxide/commit/379d9c77b8a46fdcb17d7381326441e5cc896b19, since it adds an (undocumented) method to create a browser connection using a specified timeout. I think it doesn't cover newly launched instances though.

Edit: Nvm, I just tried configuring it using that and it still times out. I guess there must be some other timeout it's using?

chirok11 commented 9 months ago

@ccapitalKW You may try src/handler/commandfuture.rs and modifying L50. If it helps, then need PR to implement ability to configure command timeout and pass to commandfuture.

Yes, mentioned commit adds an method to create browser and provide custom timeout (in past it was fixed to 60s), but it relates only to request timeout (when waiting till page load).

But it does not relate to command's.

You have to try to modify mentioned file and tell if it helps.