{"issue":{"milestone":null,"user":{"login":"RVN-BR","id":1218902,"url":"https://api.github.com/users/RVN-BR","avatar_url":"https://secure.gravatar.com/avatar/e33af81d39f14364d23b04a622ce8594?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"e33af81d39f14364d23b04a622ce8594"},"title":"Non time-based loop?","created_at":"2011-12-19T16:47:21Z","labels":[],"updated_at":"2011-12-19T18:37:01Z","state":"open","id":2602695,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"html_url":"https://github.com/shaneharter/PHP-Daemon/issues/5","closed_at":null,"body":"Hi,\r\n\r\ncongrats on php-daemon!  I've just started looking into the framework and find it quite cool and complete!  Especially good the cluster-based functionality, very useful.  A couple of questions/comments maybe you can help steer me:\r\n\r\n- my first daemon needs to poll a particular webservice queue which wasnt developed by us.  Nonetheless, the webserver is \"blocking\", and when it reaches the last even it will \"wait\" 10 seconds... basically, I need a non-time-looped daemon.  Would this be something possible to implement?  Basically, whenever it reaches the end, start again...  I could just put 1 second interval, but that would flood my e-mail box, and potentially give other complications?  (Is there somewhere to disable these catches? would this be the best way?)\r\n\r\n- on another note, do you see any implications in porting the memcache portion of your code to use Redis instead?  We have changed from memcache to redis for most of our use, and were thikning of disabling the memcache cluster, but we could always keep it for this daemon control (although i'd prefer to just port a lock plugin for redis).\r\n\r\nAnyways, great work.  I think this will be very useful in several jobs, and when combined with a message queue such as php-resque or whichever one anyone prefers, gives us a complete toolbox for work...","number":5,"url":"https://api.github.com/repos/shaneharter/PHP-Daemon/issues/5","comments":1,"assignee":null},"comment":{"user":{"login":"shaneharter","id":554211,"url":"https://api.github.com/users/shaneharter","avatar_url":"https://secure.gravatar.com/avatar/573b0abaa71b7cf74c4f3cc482b67dcd?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"573b0abaa71b7cf74c4f3cc482b67dcd"},"created_at":"2011-12-19T18:37:01Z","updated_at":"2011-12-19T18:37:01Z","id":3207389,"body":"Hi,\n\nGlad you found it useful!\n\nFirst, about Redis...\nI think you should be able to create a Redis lock adapter class very easily\nusing the memcache one as a template. And you won't need to worry about\nreplicating what's in Memcache.php -- that is there to work around bugs in\nmemcache that I've never experienced in redis anyway (auto-retry). Sure,\nthe auto namespacing and stuff would be useful so if you wanted to\nimplement that, great, but just to use redis as a lock provider, just\ncreate a redis.php class in the /Lock directory. If you submit that in a\npull request i'll merge it in and help maintain it.\n\nNow, about the non time-base thing.\nI think the easiest way to do this is going to be to create your own very\nbasic fork of the code base. Then, in the Core_Daemon class, change the\ntimer() method from private to protected.\n\nThen, in your daemon class, use your own timer() method. Make it so it\nkeeps a count internally, and when it gets to 10, sleep 10 seconds. That is\n-- make it behave in whatever way the webservice forces you to. I won't\nwant to merge that into trunk (i want to keep the method private) but this\nis what GitHub is great for. You can make a simple fork and anybody that\nneeds non time-based daemon can clone from your repo!\n\nThanks for the compliments, let me know if you run into anything strange!\nShane\n\nOn Mon, Dec 19, 2011 at 8:47 AM, RVN-BR <\nreply@reply.github.com\n> wrote:\n\n> Hi,\n>\n> congrats on php-daemon!  I've just started looking into the framework and\n> find it quite cool and complete!  Especially good the cluster-based\n> functionality, very useful.  A couple of questions/comments maybe you can\n> help steer me:\n>\n> - my first daemon needs to poll a particular webservice queue which wasnt\n> developed by us.  Nonetheless, the webserver is \"blocking\", and when it\n> reaches the last even it will \"wait\" 10 seconds... basically, I need a\n> non-time-looped daemon.  Would this be something possible to implement?\n>  Basically, whenever it reaches the end, start again...  I could just put 1\n> second interval, but that would flood my e-mail box, and potentially give\n> other complications?  (Is there somewhere to disable these catches? would\n> this be the best way?)\n>\n> - on another note, do you see any implications in porting the memcache\n> portion of your code to use Redis instead?  We have changed from memcache\n> to redis for most of our use, and were thikning of disabling the memcache\n> cluster, but we could always keep it for this daemon control (although i'd\n> prefer to just port a lock plugin for redis).\n>\n> Anyways, great work.  I think this will be very useful in several jobs,\n> and when combined with a message queue such as php-resque or whichever one\n> anyone prefers, gives us a complete toolbox for work...\n>\n> ---\n> Reply to this email directly or view it on GitHub:\n> https://github.com/shaneharter/PHP-Daemon/issues/5\n>","url":"https://api.github.com/repos/shaneharter/PHP-Daemon/issues/comments/3207389"},"action":"created"}