Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix connection sharing #203

Merged
merged 6 commits into from Mar 25, 2014

Conversation

@jipiboily
Copy link
Contributor

commented Mar 22, 2014

Sharing a connection as per the README was actually not working, now it is.

I did not test it a lot yet, but all my use cases seems to be covered by it at first.

Feedback welcomed!

@jipiboily jipiboily referenced this pull request Mar 22, 2014
def self.default_conn_adapter
@conn_adapter ||= ConnAdapter.new
end

def self.default_conn_adapter= conn

This comment has been minimized.

Copy link
@ryandotsmith

ryandotsmith Mar 22, 2014

Contributor

Can we use parens for this method definition? It would be consistent with the rest of the methods in this project.

This comment has been minimized.

Copy link
@jipiboily

jipiboily Mar 24, 2014

Author Contributor

Sure thing!

@@ -19,7 +19,11 @@ class Worker
def initialize(args={})
@fork_worker = args[:fork_worker] || QC::FORK_WORKER
@wait_interval = args[:wait_interval] || QC::WAIT_TIME
@conn_adapter = ConnAdapter.new(args[:connection])
if QC.has_connection?

This comment has been minimized.

Copy link
@ryandotsmith

ryandotsmith Mar 22, 2014

Contributor

What if QC.has_connection? but you would still like to provide a new connection for a particular instance of a worker?

This comment has been minimized.

Copy link
@jipiboily

jipiboily Mar 24, 2014

Author Contributor

Good point!

ryandotsmith added a commit that referenced this pull request Mar 25, 2014

@ryandotsmith ryandotsmith merged commit 897798b into QueueClassic:master Mar 25, 2014

1 check passed

default The Travis CI build passed
Details
@ryandotsmith ryandotsmith referenced this pull request Mar 25, 2014
2 of 2 tasks complete

@jipiboily jipiboily deleted the jipiboily:fix-connection-sharing branch Mar 25, 2014

@cschramm

This comment has been minimized.

Copy link
Contributor

commented on c972edc Aug 22, 2014

This doesn't make much sense to me. We have if and elsif and ... nothing. We can end up without a connection.

From the code:

The canonical example of starting a worker is as follows:
QC::Worker.new.start

Won't work as neither :connection is specified, nor does QC have a connection yet.

This comment has been minimized.

Copy link
Contributor Author

replied Aug 22, 2014

Just for future ppl here, there is an issue for this -> #225.

This comment has been minimized.

Copy link

replied Sep 2, 2014

I ran into this problem today. I have both QC_DATABASE_URL and DATABASE_URL set, but it never setup the connection.

Following the solution in #225 solved the issue for me.

The documentation does not follow what the code should be doing.

This comment has been minimized.

Copy link
Contributor Author

replied Sep 3, 2014

FYI, v3.0.1 with this fixed was released yesterday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.