I'm new to node-celery and am trying to start simple by getting a result from a celery task. I've written my JS in an 'await' fashion in order to wait for the result from the celery and then move forward, however, it seems the JS never gets a result from 'client.call('task')'
Celery Code:
@app.task(base=QueueOnce)
def add(x, y):
return x + y
Node JS Code:
async function addCelery() {
client = celery.createClient({
CELERY_BROKER_URL: "redis://myurl.com:0000"
});
let clientResult = new Promise((resolve, reject) => {
console.log("Log 1"); //This shows in the console
client.on('connect', () => {
console.log("Log 2"); //This also shows in console, making me believe it connected successfully
var call = client.call('tasks.add', [1,2]); //Call task
console.log("Log 3"); //This also shows in console, making me believe the task call is called successfully
call.on('ready', function(result){ //When call gets result
console.log(result); //Never gets here
});
});
})
await clientResult;
console.log('done'); //Never gets here
I'm not sure exactly why it's never getting past the never getting a result from the call. A lot of the console.log()'s I have for debugging make me believe it's successfully connecting and calling the task
Is it not connecting to the celery? Am I calling the task wrong? It shouldn't be a time thing as I've executed this and waited 10 mins still with no result. I'm very new to this so any help would be appreciated