Unable to call asynchronous functions repeatedly
See original GitHub issueHi, I’m trying to run some redis commands at some intervals
var j = schedule.scheduleJob(rule, test(function(reply) {
console.log(reply);
}));
function test(callback) {
client.get('mykey', function (err, reply) {
callback(reply);
});
}
However, it executes successfully once and then subsequently execution resulted in error:
Cannot read property 'execute' of undefined
What am I doing wrong? Please advise.
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How to call a async method repeatedly until you get success ...
I have to keep calling this async method from another method until I get success. But if it fails repeatedly for 5 times...
Read more >Retry asynchronous function using the callback pattern ...
In this article, I'm going to show how you can retry an asynchronous function in JavaScript, using the callback pattern, promise chain ...
Read more >How to escape async/await hell - freeCodeCamp
While working with Asynchronous JavaScript, people often write multiple statements one after the other and slap an await before a function call.
Read more >Asynchronous JavaScript: Async/Await Tutorial - Toptal
This article introduces you to asynchronous JavaScript and explains why you should start using async/await functions today.
Read more >How JavaScript works: Event loop and the rise of Async ...
While the Call Stack has functions to execute, the browser can't do anything else — it's being blocked. This means that the browser...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I get this error
Cannot read property 'execute' of undefined
when I try to run
schedule.scheduleJob('*/5 * * * * *', UpdateTiles("5sec"));
as opposed to
which works perfectly. UpdateTiles has a mongodb query in it. That’s probably the way node-schedule is designed but I’m just putting this here because I found it in google. Exporting it as a function within a module didn’t work as suggested above
@hydrix9 Did you manage to fix it?