Is there a way to disable the persistant plugin in the faraday adapter? #16
-
Context: Is there a way to disable the persistent plugin while using the faraday adapter? or should I monkey patch the faraday adapter for this use case? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @m-arav , You can disable persistence of connections by setting the # while setting yourr faraday conn
conn.adapter :httpx, persistent: false That sucks, your use-case is actually something I mention as a caveat when using the persistent plugin in the wiki. I've enabled persistent connections in the faraday adapter because I thought that it would serve the majority of use-cases, as most faraday users complain about it not reusing tcp connections for same-origin requests by default (I believe the faraday maintainers maintain a page listing adapters with socket persistence support). My assessment may be wrong here, and there may be more faraday users which prefer the approach you mentioned. Sadly, there's not a faraday "handle" to signal to the adapter which configuration is preferred in this case. I'd recommend discussing this with the faraday maintainers to see what do they think about this, what should be the default behaviour, and whether it's worth to add an option to signal to the adapters whether sockets should be kept open for re-usage (for the adapters which support this at least). |
Beta Was this translation helpful? Give feedback.
Hi @m-arav ,
You can disable persistence of connections by setting the
persistent
option tofalse
:That sucks, your use-case is actually something I mention as a caveat when using the persistent plugin in the wiki.
I've enabled persistent connections in the faraday adapter because I thought that it would serve the majority of use-cases, as most faraday users complain about it not reusing tcp connections for same-origin requests by default (I believe the faraday maintainers maintain a page listing adapters with socket persistence support).
My assessment may be wrong here, and there may be more faraday users which pre…