r-a-y / bp-reply-by-email

Reply to BuddyPress items from the comfort of your email inbox. Currently in pre-release.
GNU General Public License v2.0
63 stars 9 forks source link

IMAP - Replace locking system with a daemon or queue system #56

Open r-a-y opened 10 years ago

r-a-y commented 10 years ago

The current IMAP locking system is not 100% foolproof.

If the auto-connect option is off and a site has a ton of concurrent users per second (greater than 12) during the time when a new IMAP inbox connection is needed, a ton of duplicate IMAP connections will occur, which could cause duplicate posts. This could happen on a high-trafficked site, but for the majority of sites, this should be okay.

If your site suffers from this, use the "Automatically Reconnect?" setting to only initiate the IMAP connection from the RBE settings page, available in 1.0-RC5+.

Otherwise, using a daemon or a proper queue system would resolve these problems:

However, this increases the server requirements:

PHP-Daemon

beanstalkd

I'm kind of dropping support for IMAP mode in favor of inbound email (#46). This is just a note if someone wants to help implement this via a plugin, which should be possible now that the IMAP locking functions are pluggable (see commit 2adc4d0).

r-a-y commented 8 years ago

For those using IMAP with RBE, I've created a small drop-in plugin so you can use a persistent object cache instead of the filesystem for IMAP's locking mechanism: https://gist.github.com/r-a-y/3efa6fa0a4c51969ad023609cbc51f15

This is helpful if you are using your site on a load balancer.

I've only tested this with Memcached and the WP PECL Memcached Object Cache plugin: https://github.com/tollmanz/wordpress-pecl-memcached-object-cache

To use this plugin, deactivate RBE, add the drop-in plugin in /wp-content/mu-plugins/ or activate as a regular plugin, and then reactivate RBE.

Other object cache plugins might work, but depending on the implementation, the code might need some modification.

I still recommend to use Inbound Mode if you are starting from scratch: https://github.com/r-a-y/bp-reply-by-email/wiki/Starter-Guide#1-inbound-email-mode