Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't retrieve result in callback

See original GitHub issue

First of all - thank you for this wonderful library 😃

I’m trying to retrieve the result of a task from within a callback which does not work. My minimal setup:


import time
import huey

huey_queue = huey.SqliteHuey(filename='demo2.db')

def task_success(signal, task):

def slow_task():
    return "OK"

from demo2 import slow_task

k1 = slow_task()

Terminal 1: demo2.huey_queue

Terminal 2: py

Output in terminal 1:

demo2.slow_task: 1c0a3cd7-2132-46c4-b37f-d1cf124dfcfd

However when I open IDLE / ptpython or standard python prompt, I can import the huey_queue and retrieve the result:

from demo2 import huey_queue
res = huey_queue.get("1c0a3cd7-2132-46c4-b37f-d1cf124dfcfd")

Am I doing something wrong or is it not possible to retrieve the result within the callback? I tried adding a delay in the callback before retrieving the results but it made no difference.

Win10 Python3.7.3 huey 2.1.2

/EDIT removed unnecessary line

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

coleifercommented, Oct 16, 2019

Pushed 2.1.3

sometimescool22commented, Oct 16, 2019


Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't return data from callback function at NodeJS
console.log(s); will execute immediately after assigning function to var s , and function returns the value after the find query, so the inital ......
Read more >
How to access the correct this inside a callback
We explore the methods for accessing the correct this in a callback by explicitly forcing a context binding to point to our object...
Read more >
Callback Hell
Callback Hell. A guide to writing asynchronous JavaScript programs. What is "callback hell"? Asynchronous JavaScript, or JavaScript that uses callbacks, ...
Read more >
How to retrieve value returned by a callback function? - Reddit
You can't. Use a callback to return the value. Or you can use promises, along with fs.promises .
Read more >
How to return the result of an asynchronous function in ...
Find out how to return the result of an asynchronous function, promise based or callback based, using JavaScript.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found