Each job runs twice #19

Closed
wolframarnold opened this Issue Apr 30, 2012 · 4 comments

Comments

Projects
None yet
2 participants

I'm observing peculiar behavior with Jesque. Each job that's pushed onto the queue causes the worker's run() method to be called twice. I can't tell if I'm doing something wrong or if there is some bug in Jesque. I've double checked though using the resque-web tool that there is really only one job in the queue. At the end of the run, I see the output twice:

Done...
Done...

My worker invocation looks like this:

public class JesqueViz extends JesqueWorker {

    public static void main(String[] args) throws Exception {
        final Config config = configureRedisConnection();

        final Worker worker = new WorkerImpl(config,
                Arrays.asList("viz"), 
                map(entry("com.foobar.viz.VizWorker", VizApp.class)));

        final Thread t = new Thread(worker);
        t.start();
        t.join();
    }    
}

And the worker's (VizApp's) run() method:

public class VizApp implements Runnable {

    public void run() {
        // do stuff
        System.out.println("Done...");
    }
}

After further diagnostic with a friend, I think my problem is that I had workers hanging in redis which weren't cleaned up properly, because my code never called end() on the worker. My guess is that this has to do with the multiple dispatch issue.

I take it back, after cleaning out all the workers (I ran flushall from the redis-cli command line and checked with the resque-web tool) -- the job still runs twice. I have no idea what's wrong. Sun JDK 1.6.0_26, on Linux 64 bit.

Nope, I take it back again. Coding error -- I have a base class for the app which called run() in the constructor by accident...

Owner

gresrun commented May 7, 2012

Glad you were able to figure it out. Let me know if I can be of any further assistance.

@ghost ghost assigned gresrun May 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment