Plugin Directory

Changeset 2752856


Ignore:
Timestamp:
07/07/2022 03:07:01 AM (4 years ago)
Author:
winrid
Message:

3.12.2 - Bugfixes on initial sync after changing data location.

Location:
fastcomments
Files:
40 added
3 edited

Legend:

Unmodified
Added
Removed
  • fastcomments/trunk/README.txt

    r2746763 r2752856  
    44Requires at least: 4.6
    55Tested up to: 6.0
    6 Stable tag: 3.12.1
     6Stable tag: 3.12.2
    77Requires PHP: 5.2.5
    88License: GPLv2 or later
     
    8888== Changelog ==
    8989
     90= 3.12.2 =
     91* Bugfixes on initial sync after changing data location.
     92
    9093= 3.12.1 =
    9194* Improved support for keeping your data in the EU.
  • fastcomments/trunk/core/FastCommentsIntegrationCore.php

    r2678152 r2752856  
    234234    }
    235235
     236    private function tryAckLock($name, $windowSeconds) {
     237        $secondsRemaining = $windowSeconds;
     238        $retryInterval = 1;
     239        $gotLock = $this->canAckLock($name, $windowSeconds);
     240        while (!$gotLock && $secondsRemaining > 0) {
     241            $gotLock = $this->canAckLock($name, $windowSeconds);
     242            if (!$gotLock) {
     243                $secondsRemaining = $secondsRemaining - $retryInterval;
     244                sleep($retryInterval);
     245            }
     246        }
     247        return $gotLock;
     248    }
     249
     250    private function resetLock($name, $windowSeconds) {
     251        $settingName = $this->getLockName($name);
     252        $this->setSettingValue($settingName, time() + $windowSeconds);
     253    }
     254
    236255    private function getLockName($name) {
    237256        return "lock_$name";
     
    249268         */
    250269        $this->log('debug', 'Starting to send comments');
    251         if (!$this->canAckLock("commandSendComments", 60)) {
     270        // We use try and not "canAckLock" in case the cron runs within a second of sync, don't let cron fail.
     271        if (!$this->tryAckLock("commandSendComments", 60)) {
    252272            $this->log('debug', 'Can not send right now, waiting for previous attempt to finish.');
    253273            return 'LOCK_WAITING';
     
    338358            $this->log('error', "Failed to get comments to send: status=[$status] comments=[$comments]");
    339359        }
    340         $this->clearLock("commandSendComments");
     360        $this->resetLock("commandSendComments", 1); // Instead of calling clearLock, prevent race condition on page refresh during setup where same chunk can get submitted twice. Not the worst thing in the world but looks weird to user.
    341361        $this->log('debug', 'Done sending comments');
    342362        return $countSynced;
  • fastcomments/trunk/fastcomments-wordpress-plugin.php

    r2746763 r2752856  
    44Plugin URI: https://fastcomments.com
    55Description: Live Comments, Fast. A comment system that will delight your users and developers.
    6 Version: 3.12.1
     6Version: 3.12.2
    77Author: winrid @ FastComments
    88License: GPL-2.0+
     
    1414}
    1515
    16 $FASTCOMMENTS_VERSION = 3.121;
     16$FASTCOMMENTS_VERSION = 3.122;
    1717
    1818require_once plugin_dir_path(__FILE__) . 'admin/fastcomments-admin.php';
Note: See TracChangeset for help on using the changeset viewer.