javascript - Update value in DB every five minutes -


i building webapp user have ranking based on twitter activity , activity on website.

therefore i'd update rank every 5 minutes, pulling latest activity twitter , update in database. thinking of using this:

var minutes = 5, the_interval = minutes * 60 * 1000; setinterval(function() {   // update here }, the_interval); 

however, have several questions code:

  1. where should save make sure run?
  2. will slow program or problem pull data out of twitter every 5 minute? should use streaming api instead?

note: using mongodb

i'd suggest create scheduled task/chron job/etc. (depends on host os) call separate node.js application performs specific tasks want periodically , exit when complete. (or use childprocess potentially well).

while node.js async, there's no need, given description provided, perform work within same application process serving web application. in fact, sounds "busy work", best handled distinct process avoid impacting directly of interactive web users.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -