tags:

views:

24

answers:

1

I am building an app that lets users link their facebook, twitter, linkedin accounts to my app and than post updates to all these sites through my app. Additionally user can 'post-date' status updates. They can set a date and time to their update, and which will cause the update to be posted to the requested sites only at the specified date and not immediately.

I have got this working fine with a cron job that pulls out all updates that have not been posted yet (there's a flag indicating whether an update has been posted or not in the DB) and then posting it. I run this process every minute using cron. Now my issue is that, with enough updates set to the same time, I'll have problems with PHP maxing out the execution time. My immediate work around has been to get all updates which have a post_timestamp < current_timestamp and try to post them; so that if for a particular minute, some updates have not been sent, the next cron run will try to send it if it is still inside the max execution time limit.

I know this is a very lame ass way of achieving what I want. Hence I plan to have some kind of a daemon process which keeps on running and posts all post-dated updates. What's the best way of achieving this? I also need this daemon approach for another project I am working on. any help in this regard would be greatly appreciated... :P

Thanks in advance.

A: 

Gearman is probably what you are looking for: http://gearman.org/

Sjon