Plugin Directory

Changeset 2576818


Ignore:
Timestamp:
08/02/2021 10:06:48 PM (5 years ago)
Author:
winrid
Message:

3.9.1 - Initial sync improved

Location:
fastcomments
Files:
34 added
3 edited

Legend:

Unmodified
Added
Removed
  • fastcomments/trunk/README.txt

    r2576755 r2576818  
    44Requires at least: 4.6
    55Tested up to: 5.8
    6 Stable tag: 3.9
     6Stable tag: 3.9.1
    77Requires PHP: 5.2.4
    88License: GPLv2 or later
     
    8585== Changelog ==
    8686
     87= 3.9.1 =
     88* Initial sync has been sped up and some bugs fixed.
     89
    8790= 3.9 =
    8891* Sync of comments from WordPress to FastComments when there are many comments improved.
  • fastcomments/trunk/core/FastCommentsIntegrationCore.php

    r2576755 r2576818  
    216216    }
    217217
     218    private function canAckLock($name, $window) {
     219        $settingName = $this->getLockName($name);
     220        $lastTime = $this->getSettingValue($settingName);
     221        $now = time();
     222        if ($lastTime && $now - $lastTime < $window) {
     223            return false;
     224        }
     225        $this->setSettingValue($settingName, $now);
     226        return true;
     227    }
     228
     229    private function getLockName($name) {
     230        return "lock_$name";
     231    }
     232
     233    private function clearLock($name) {
     234        $settingName = $this->getLockName($name);
     235        $this->setSettingValue($settingName, null);
     236    }
     237
    218238    public function commandSendComments($token) {
    219239        $this->log('debug', 'Starting to send comments');
     240        if (!$this->canAckLock("commandSendComments", 3000)) {
     241            $this->log('debug', 'Can not send right now, waiting for previous attempt to finish.');
     242            return;
     243        }
    220244        $lastSendDate = $this->getSettingValue('fastcomments_stream_last_send_timestamp');
    221245        $startedAt = time();
     
    283307        $this->setSettingValue('fastcomments_setup', true);
    284308        $this->setSettingValue('fastcomments_stream_last_fetch_timestamp', time() * 1000);
     309        $this->clearLock("commandSendComments");
    285310    }
    286311
  • fastcomments/trunk/fastcomments-wordpress-plugin.php

    r2576755 r2576818  
    44Plugin URI: https://fastcomments.com
    55Description: Live Comments, Fast. A comment system that will delight your users and developers.
    6 Version: 3.9
     6Version: 3.9.1
    77Author: winrid @ FastComments
    88License: GPL-2.0+
     
    1414}
    1515
    16 $FASTCOMMENTS_VERSION = 3.9;
     16$FASTCOMMENTS_VERSION = 3.91;
    1717
    1818
Note: See TracChangeset for help on using the changeset viewer.