4 ms·
Sounds like you need a queue of some sort. What I usually see is something like each web server will dump these details (json is fine) into a file. Then at some
by andyklock 10y ago
Sounds like you need a queue of some sort. What I usually see is something like each web server will dump these details (json is fine) into a file. Then at some scheduled time these details can be inserted into your database in batch. (nightly, hourly, etc)
- ge96 10y agoDoes that suggest Cron? I mean I'm looking for something like a background running process (CRON) or Daemon haha. But for some reason I'm thinking of something like Node. I don't know.
- andyklock 10y agoIt could be cron, but mostly I'd just recommend using whatever you are comfortable supporting. Cron is great for simple batch jobs (I would imagine this would fall into that category). Cron isn't ideal when you have to chain a bunch of jobs together. But, if you have a script that loads files, cron could do the job easily enough.
- ge96 10y agoI actually figured out an alternative for this particular case. I would create a client-side JavaScript object and store stuff there, then when they leave, it makes one call to the server with the object passed as JSON. Problem then becomes cleaning the output. I was just thinking, if you can edit stuff in the browser console, can't you edit the contents of an array? I guess actually you wouldn't see that displayed in the code, it's a state maintained in browser memory I think. But I'm still considering this potential problem and making a known/limited pattern eg. numbers only separated by a known symbol like a dash to use for exploding/splitting.... anyway will try it out.