Plugin Directory

Changeset 2661187


Ignore:
Timestamp:
01/21/2022 01:47:29 AM (4 years ago)
Author:
winrid
Message:

3.10.5 - Improvements to the chunk splitting algorithm for initial setup. No longer gets stuck on sites with very large number of large comments.

Location:
fastcomments
Files:
40 added
3 edited

Legend:

Unmodified
Added
Removed
  • fastcomments/trunk/README.txt

    r2660486 r2661187  
    44Requires at least: 4.6
    55Tested up to: 5.8
    6 Stable tag: 3.10.4
    7 Requires PHP: 5.2.4
     6Stable tag: 3.10.5
     7Requires PHP: 5.2.5
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    8585
    8686== Changelog ==
     87
     88= 3.10.5 =
     89* Improvements to the chunk splitting algorithm for initial setup. No longer gets stuck on sites with very large number of large comments.
    8790
    8891= 3.10.4 =
  • fastcomments/trunk/core/FastCommentsIntegrationCore.php

    r2613148 r2661187  
    274274            $countRemaining = $commentCount;
    275275            $chunkSize = 100;
     276
    276277            if ($countRemaining > 0) {
    277278                $commentChunks = array_chunk($getCommentsResponse['comments'], $chunkSize);
     
    282283                    $dynamicChunks = array($chunk);
    283284                    while ($chunkAttemptsRemaining > 0) {
     285                        processChunks:
    284286                        foreach ($dynamicChunks as $dynamicChunk) {
    285287                            $lastComment = $dynamicChunk[count($dynamicChunk) - 1];
     
    292294                                )
    293295                            );
     296                            $dynamicChunkSizeActual = count($dynamicChunk);
    294297                            $httpResponse = $this->makeHTTPRequest('POST', "$this->baseUrl/comments?token=$token", $requestBody);
    295298                            $this->log('debug', "Got POST /comments response status code=[$httpResponse->responseStatusCode] and chunk size $dynamicChunkSize");
     
    311314                            } else if ($httpResponse->responseStatusCode === 413 && $dynamicChunkSize > 1) {
    312315                                $this->log('debug', "$dynamicChunkSize too big, splitting.");
    313                                 $dynamicChunks = array_chunk($chunk, max((int)($dynamicChunkSize / 10), 1));
    314                                 break; // break out of the dynamic chunks loop and run it again
     316                                $dynamicChunkSize = (int)($dynamicChunkSize / 10);
     317                                $dynamicChunks = array_chunk($chunk, max($dynamicChunkSize, 1));
     318                                $chunkAttemptsRemaining--;
     319                                if ($chunkAttemptsRemaining > 0) {
     320                                    goto processChunks; // break out of the dynamic chunks loop and run it again. yes goto is terrible but lot of work to refactor/test this.
     321                                }
    315322                            }
    316323                        }
  • fastcomments/trunk/fastcomments-wordpress-plugin.php

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