summaryrefslogtreecommitdiff
path: root/lib/queuehandler.php
AgeCommit message (Collapse)Author
2010-01-12Major refactoring of queue handlers to support running multiple sites in one ↵Brion Vibber
daemon. Key changes: * Initialization code moved from common.php to StatusNet class; can now switch configurations during runtime. * As a consequence, configuration files must now be idempotent... Be careful with constant, function or class definitions. * Control structure for daemons/QueueManager/QueueHandler has been refactored; the run loop is now managed by IoMaster run via scripts/queuedaemon.php IoManager subclasses are woken to handle socket input or polling, and may cover multiple sites. * Plugins can implement notice queue handlers more easily by registering a QueueHandler class; no more need to add a daemon. The new QueueDaemon runs from scripts/queuedaemon.php: * This replaces most of the old *handler.php scripts; they've been refactored to the bare handler classes. * Spawns multiple child processes to spread load; defaults to CPU count on Linux and Mac OS X systems, or override with --threads=N * When multithreaded, child processes are automatically respawned on failure. * Threads gracefully shut down and restart when passing a soft memory limit (defaults to 90% of memory_limit), limiting damage from memory leaks. * Support for UDP-based monitoring: http://www.gitorious.org/snqmon Rough control flow diagram: QueueDaemon -> IoMaster -> IoManager QueueManager [listen or poll] -> QueueHandler XmppManager [ping & keepalive] XmppConfirmManager [poll updates] Todo: * Respawning features not currently available running single-threaded. * When running single-site, configuration changes aren't picked up. * New sites or config changes affecting queue subscriptions are not yet handled without a daemon restart. * SNMP monitoring output to integrate with general tools (nagios, ganglia) * Convert XMPP confirmation message sends to use stomp queue instead of polling * Convert xmppdaemon.php to IoManager? * Convert Twitter status, friends import polling daemons to IoManager * Clean up some error reporting and failure modes * May need to adjust queue priorities for best perf in backlog/flood cases Detailed code history available in my daemon-work branch: http://www.gitorious.org/~brion/statusnet/brion-fixes/commits/daemon-work
2009-11-09Revert "Remove more contractions"Brion Vibber
This reverts commit 5ab709b73977131813884558bf56d97172a7aa26. Missed this one yesterday...
2009-11-08Remove more contractionsSiebrand Mazeland
* doesn't * won't * isn't * don't
2009-10-22Add some doc comments to QueueHandlerBrion Vibber
2009-08-26define LACONICA and accept LACONICA for backwards compatibilityEvan Prodromou
2009-08-26Merge branch '0.8.x' into testingEvan Prodromou
2009-08-26more log output in queue handlersEvan Prodromou
2009-08-25change LACONICA to STATUSNETEvan Prodromou
2009-08-25a distributed -> the distributedEvan Prodromou
2009-08-25change Laconica and Control Yourself to StatusNet in PHP filesEvan Prodromou
2009-07-17Moved $_id from queuehandler to daemon, as other daemons need it too.Zach Copley
2009-07-09use select() to bring down xmpp latencyEvan Prodromou
2009-07-04move handling code into queuemanagerEvan Prodromou
2009-07-02Merge branch '0.8.x' into queuemanagerEvan Prodromou
2009-07-01change queuehandler class to use queuemanager interfaceEvan Prodromou
2009-06-28Daemon can optionally not go into the backgroundEvan Prodromou
2009-06-24make stomp server work with username and passwordEvan Prodromou
2009-06-20Update copyright dates in files modified in 2009Evan Prodromou
2009-06-20change Controlez-Vous to Control YourselfEvan Prodromou
2009-04-03reformat queuehandler.phpEvan Prodromou
2009-02-20* implemented STOMP support for external message queueing systemsFederico Marani
* (ticket-724) * included PHP STOMP libraries (http://code.google.com/p/stompcli/)
2008-12-23move opening brace of class declaration to next lineEvan Prodromou
Another gigantor PEAR coding standards patch. Here, I've moved the opening curly bracket on a class statement to the following line. darcs-hash:20081223194923-84dde-77a93de314caadbcb5b70bf346a4648be77a864e.gz
2008-12-23change function headers to K&R styleEvan Prodromou
Another huge change, for PEAR code standards compliance. Function headers have to be in K&R style (opening brace on its own line), instead of having the opening brace on the same line as the function and parameters. So, a little perl magic found all the function definitions and move the opening brace to the next line (properly indented... usually). darcs-hash:20081223193323-84dde-a28e36ecc66672c783c2842d12fc11043c13ab28.gz
2008-12-23replace NULL with nullEvan Prodromou
Another global search-and-replace update. Here, I've replaced the PHP keyword 'NULL' with its lowercase version. This is another PEAR code standards change. darcs-hash:20081223192129-84dde-4a0182e0ec16a01ad88745ad3e08f7cb501aee0b.gz
2008-12-23replace all tabs with four spacesEvan Prodromou
The PEAR coding standards decree: no tabs, but indent by four spaces. I've done a global search-and-replace on all tabs, replacing them by four spaces. This is a huge change, but it will go a long way to getting us towards phpcs-compliance. And that means better code readability, and that means more participation. darcs-hash:20081223191907-84dde-21e8efe210e6d5d54e935a22d0cee5c7bbfc007d.gz
2008-10-05explicitly load classes for queuehandlerEvan Prodromou
darcs-hash:20081005191505-5ed1f-f0783711adae8381c5ca987f3f7299393ed435e1.gz
2008-09-05free and unset DB_DataObjects after we're done with themEvan Prodromou
darcs-hash:20080906015501-84dde-e787962b9805759224389dd42a211dfa21da3473.gz
2008-09-04scripts daemonize themselvesEvan Prodromou
darcs-hash:20080904184031-84dde-eba2061f3aa898d0c791ffeb70837f759778c567.gz
2008-08-30switch around how XMLStream does processingEvan Prodromou
darcs-hash:20080831003210-84dde-92ccffd5b2e1d50963b18babd93c70fb1d20cdba.gz
2008-08-30some fixes from on the jabber serverevan
darcs-hash:20080830083502-5b646-d6a66157d86ca84cfa6cf6280bb2eb17bc20e02d.gz
2008-08-30less sleeping, slightlyEvan Prodromou
darcs-hash:20080830064431-84dde-42629109de11f65da9d876aee168abdf7c4ced3d.gz
2008-08-29many jabber queue management changesEvan Prodromou
Added a method to QueueManager to let subclasses do stuff when idle. Needed so that XMPP queue manager can service its message queue. Cleaned up jabber_broadcast_message quite a bit. Use custom joins instead of loop-and-query, should fix some problems with users who are getting messages even after turning off notification. Only build $msg and $entry once, and use the XMPPHP function for messages with a payload, rather than rolling our own. darcs-hash:20080829200352-84dde-427e4ca8c81d4222a36f78e7c580b611ff0bf765.gz
2008-08-27don't clear claims immediatelyEvan Prodromou
darcs-hash:20080828002610-84dde-d9cb46cb08ac50b8efbdf5683baeb2de168fc4b1.gz
2008-08-27break up monolithic xmppdaemon into multiple queue handlersEvan Prodromou
Eventually, the poor xmppdaemon has become overloaded with extra tasks. So, I've broken it up. Now, we have 5 background scripts, and more coming: * xmppdaemon.php - handles incoming XMPP messages only. * xmppqueuehandler.php - sends notices from the queue out through XMPP. * smsqueuehandler.php - sends notices from the queue out over SMS * ombqueuehandler.php - sends notices from the queue out over OMB * xmppconfirmhandler.php - sends confirmation requests out over XMPP. This is in addition to maildaemon.php, which takes incoming messages. None of these are "true" daemons -- they don't daemonize themselves automatically. Use nohup or another tool to background them. monit can also be useful to keep them running. At some point, these might become fork()'ing daemons, able to handle more than one notice at a time. For now, I'm just running multiple instances, hoping they don't interfere. darcs-hash:20080827205407-84dde-97884a12f5f4e54c93bc785bd280683d1ee7e749.gz