Open igreenfield opened 7 years ago
Hi @jhalterman do you know why the lib always copy? hence when we use new version of the factory it may have new properties and if we forget to copy this it may be problem....
@igreenfield The thinking was that options are things that help you create a Connection, which cannot be changed once the connection is made, and Config are things that can be changed after the Connection is made. A new version of a connection factory should require a new connection, right?
@jhalterman New Connection yes, but hear you create connection from options the user pass to you... so why you copy it first? even if you do copy do you need deep copy?
@igreenfield The thinking was I didn't want changes to the Options
object to effect future connection attempts which is why we make a copy.
What sort of use case do you have where this is a problem?
@jhalterman The 'ConnectionOptions' object expose the factory so as user I can change it and I will expect that my changes will take effect but with the copy it won't happen...
@igreenfield That's true. You would prefer ConnectionFactory
changes to take effect if the connection is ever lost and recovered? In that case, why not make a new connection? As for the current behavior, do you think this could use more clarification in the docs?
@jhalterman If I use the withConnectionFactory
option and pass in my factory I would think the lib will use it but in the current implementation the lib will copy part of it and use other instance... this is not so good...
I see in class Connections lines 108 - 118:
Why on line 113 you copy the options? or inside this class copy the ConnectionFactory and not reuse it?