Replies: 1 comment
-
👋 I knew this conversation was inevitable! So the history here is that this is/was a port of the python version of course, and I wanted things to be similar/consistent. Hence the timeouts behaving more or less like the python flavor. Overhauling scrapligo to be like "normal"/idiomatic go where the context is always the first arg and such would defo have to be a 2.x kind of thing and would probably be a ton more work than it seems at first glance... this is obviously an option though. Another option that would be much easier and I think less idiomatic but more "scrapli-like" could be to add an "operation option" d.GetConfig("running", opoptions.WithContext(my context)) Again, not super "idiomatic" I suppose, but surely would be easier to implement, could be done w/out a major version change (though I dont have any particular problem bumping to 2.x other than the amount of work doing the first way would be!), and would not have the annoying (to me) ctx as first option everywhere. What do you think? Would you be interested in doing a proof of concept for either option (or something else if you have other thoughts)? Just for like one method just so we can see how it works and what we think. Also cc @hellt since he and I chatted about this a bit and he may have some more great insight as always! Thanks for raising this discussion, definitely an interesting one! Carl |
Beta Was this translation helpful? Give feedback.
-
Hello,
This is a feature request more that anything :)
Since interacting with a router can be a long(-ish) operation, it would be nice to support passing go context to all of scrapligo methods that involve I/O (such as
Open
,Get
,GetConfig
,Close
) so that we can control blocking operation timeouts in a more granular manner.Beta Was this translation helpful? Give feedback.
All reactions