ryandotsmith/queue_classic — Issue #16: Worker loads PL/pgSQL function on initialization
Author: ryandotsmith
Created: 2011-10-26 23:40:54+00:00
State: open
Labels: feature

One thing that has always bothered me in the queue_classic setup process is this line:

```bash
$ ruby -r queue_classic -e "QC::Database.new.load_functions"
```

Some people call this function in an irb session, others place it in a migration. There has got to be a better way.
One idea is to have the worker load the function when it is initialized. Producers do not need this function thus is is safe to have the worker be responsible for loading it's function.

We would have to create or replace the function each time we init a worker, so we should figure out some algorithm that loads the function only if it is not already there.