acoder, thanks, this is exactly what I did. The script checks the timestamp of the data first thing and only fetches new data if ten seconds have elapsed. The data file is updated after a new fetch. Thanks again; here's the code I used.
I guess my last worry is about read/write interference if the system takes on a lot of users at once. Maybe I'll try gits' write-lock idea...
User Profile
Collapse
-
I ultimately did as Glenton suggested: had the CGI script check to see if ten seconds had elapsed since the last data file-write, if not, get new GPS data and update the data file with a timestamp.
My code is posted as part of a bus-tracking project here.Leave a comment:
-
I've got a very small site with hostgator; I'm very satisfied with their support and features.Leave a comment:
-
Glenton, thanks, you're right; there's certainly no need to update the buffer when there are no viewers.
Are there concurrency issues if multiple users are trying to read/edit a buffer file simultaneously? User number would be low and the file size would also be quite low, so maybe not?Leave a comment:
-
gits -- thanks, I read into my host's TOS and they don't want cron jobs running more than once every 15 minutes.. What if I had a local script pull GPS data every 10s then upload a new file to the server if the data has changed? That just seems inefficient but I'm struggling to think of another option.Leave a comment:
-
limit Python CGI's frequency of calls to an external database?
I've got a Python CGI script that pulls data from a GPS service; I'd like this information to be updated on the webpage about once every 10s (the max allowed by the GPS service's TOS). But there could be, say, 100 users viewing the webpage at once, all calling the script.
I think the users' scripts need to grab data from a buffer page that itself only upates once every ten seconds. How can I make this buffer page auto-update if there's... -
limit Python CGI's frequency of calls to a database?
I've got a Python CGI script that pulls data from a GPS service; I'd like this information to be updated on the webpage about once every 10s (the max allowed by the GPS service's TOS). But there could be, say, 100 users viewing the webpage at once, all calling the script.
I think the users' scripts need to grab data from a buffer page that itself only upates once every ten seconds. How can I make this buffer page auto-update if there's...
No activity results to display
Show More
Leave a comment: