Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. function performScheduledUpdateOfDataInRedis(index, url, fn = null) {
  2. //updateDataInRedis(index, url, fn);
  3. console.info(getTimeLeftBeforeUpdate());
  4. setTimeout(function () {
  5. return performScheduledUpdateOfDataInRedis(index, url, fn);
  6. }, getTimeLeftBeforeUpdate());
  7. }
  8.  
  9. module.exports = {
  10. scheduleUpdatesInRedis : (index, url, fn = null) => {
  11. console.info(`Updates of ${index} [${url}] in redis have been scheduled`);
  12. setTimeout(() => {
  13. console.info('performScheduledUpdateOfDataInRedis(index, url, fn);');
  14. return performScheduledUpdateOfDataInRedis(index, url, fn); // It will be called infinitely unless interrupted
  15. }, getTimeLeftBeforeUpdate());
  16. },
  17.  
  18. scheduleRanksUpdates : () => {
  19. console.info(`Updates of ranks in redis have been scheduled`);
  20. setTimeout(() => {
  21. return performScheduledRanksUpdatesInRedis(); // It will be called infinitely unless interrupted
  22. }, getTimeLeftBeforeUpdate());
  23. }
  24. }
  25.  
  26. OUTPUT:
  27. "performScheduledUpdateOfDataInRedis(index, url, fn);
  28. 31518656000
  29. 31518656000
  30. 31518656000
  31. 31518656000
  32. 31518656000
  33. 31518656000
  34. 31518655000
  35. 31518655000
  36. 31518655000
  37. 31518655000
  38. 31518655000
  39. 31518655000
  40. 31518655000
  41. 31518655000
  42. 31518655000
  43. 31518655000
  44. 31518655000"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement