Changeset 2586120
- Timestamp:
- 08/20/2021 05:23:13 PM (5 years ago)
- Location:
- fastcomments
- Files:
-
- 34 added
- 3 edited
-
tags/3.9.7 (added)
-
tags/3.9.7/.gitignore (added)
-
tags/3.9.7/LICENSE (added)
-
tags/3.9.7/README.md (added)
-
tags/3.9.7/README.txt (added)
-
tags/3.9.7/admin (added)
-
tags/3.9.7/admin/fastcomments-admin-setup-view.js (added)
-
tags/3.9.7/admin/fastcomments-admin-setup-view.php (added)
-
tags/3.9.7/admin/fastcomments-admin-sso-view.css (added)
-
tags/3.9.7/admin/fastcomments-admin-sso-view.js (added)
-
tags/3.9.7/admin/fastcomments-admin-sso-view.php (added)
-
tags/3.9.7/admin/fastcomments-admin-support-view.php (added)
-
tags/3.9.7/admin/fastcomments-admin-view.php (added)
-
tags/3.9.7/admin/fastcomments-admin.css (added)
-
tags/3.9.7/admin/fastcomments-admin.php (added)
-
tags/3.9.7/admin/images (added)
-
tags/3.9.7/admin/images/api.png (added)
-
tags/3.9.7/admin/images/crown.png (added)
-
tags/3.9.7/admin/images/css.png (added)
-
tags/3.9.7/admin/images/debugging.png (added)
-
tags/3.9.7/admin/images/download.png (added)
-
tags/3.9.7/admin/images/home.png (added)
-
tags/3.9.7/admin/images/logo-50.png (added)
-
tags/3.9.7/admin/images/logo.png (added)
-
tags/3.9.7/admin/images/support.png (added)
-
tags/3.9.7/admin/images/sync.png (added)
-
tags/3.9.7/core (added)
-
tags/3.9.7/core/FastCommentsIntegrationCore.php (added)
-
tags/3.9.7/core/FastCommentsWordPressIntegration.php (added)
-
tags/3.9.7/fastcomments-wordpress-plugin.php (added)
-
tags/3.9.7/public (added)
-
tags/3.9.7/public/fastcomments-public.php (added)
-
tags/3.9.7/public/fastcomments-widget-view.php (added)
-
tags/3.9.7/uninstall.php (added)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/core/FastCommentsIntegrationCore.php (modified) (1 diff)
-
trunk/fastcomments-wordpress-plugin.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fastcomments/trunk/README.txt
r2585075 r2586120 4 4 Requires at least: 4.6 5 5 Tested up to: 5.8 6 Stable tag: 3.9. 66 Stable tag: 3.9.7 7 7 Requires PHP: 5.2.4 8 8 License: GPLv2 or later … … 84 84 85 85 == Changelog == 86 87 = 3.9.7 = 88 * Dynamically adjust request size on initial sync to ensure all comments are migrated while still keeping the initial sync fast. 86 89 87 90 = 3.9.6 = -
fastcomments/trunk/core/FastCommentsIntegrationCore.php
r2577475 r2586120 260 260 } 261 261 // while ($hasMore && time() - $startedAt < 30 * 1000) { 262 $this->log('debug', 'Send comments command loop...'); 263 $getCommentsResponse = $this->getComments($lastSendDate ? $lastSendDate : 0); 264 if ($getCommentsResponse['status'] === 'success') { 265 $count = count($getCommentsResponse['comments']); 266 $hasMore = $getCommentsResponse['hasMore']; 267 $this->log('info', "Got comments to send count=[$count] hasMore=[$hasMore]"); 268 $countRemaining = $getCommentsResponse['comments'] ? count($getCommentsResponse['comments']) : 0; 269 if ($countRemaining > 0) { 270 $commentChunks = array_chunk($getCommentsResponse['comments'], 100); 271 foreach ($commentChunks as $chunk) { 272 $lastCommentFromDateTime = strtotime($chunk[count($chunk) - 1]['date']) * 1000; 273 $countRemaining -= count($chunk); 274 $requestBody = json_encode( 275 array( 276 "countRemaining" => $countRemaining, 277 "comments" => $chunk 278 ) 279 ); 280 $httpResponse = $this->makeHTTPRequest('POST', "$this->baseUrl/comments?token=$token", $requestBody); 281 $this->log('debug', "Got POST /comments response status code=[$httpResponse->responseStatusCode]"); 282 $response = json_decode($httpResponse->responseBody); 283 // if ($response->status === 'success') { 284 $fromDateTime = $lastCommentFromDateTime; 285 $lastSendDate = $fromDateTime; 286 $this->setSettingValue('fastcomments_stream_last_send_timestamp', $fromDateTime); 287 if ($countRemaining <= 0) { 288 $this->setSetupDone(); 289 break; 262 $this->log('debug', 'Send comments command loop...'); 263 $getCommentsResponse = $this->getComments($lastSendDate ? $lastSendDate : 0); 264 if ($getCommentsResponse['status'] === 'success') { 265 $count = count($getCommentsResponse['comments']); 266 $hasMore = $getCommentsResponse['hasMore']; 267 $this->log('info', "Got comments to send count=[$count] hasMore=[$hasMore]"); 268 $countRemaining = $getCommentsResponse['comments'] ? count($getCommentsResponse['comments']) : 0; 269 $chunkSize = 100; 270 if ($countRemaining > 0) { 271 $commentChunks = array_chunk($getCommentsResponse['comments'], $chunkSize); 272 foreach ($commentChunks as $chunk) { 273 // for this chunk, attempt to send the whole thing. If it fails, split it up. 274 $chunkAttemptsRemaining = 5; 275 $dynamicChunkSize = $chunkSize; 276 $dynamicChunks = array($chunk); 277 while ($chunkAttemptsRemaining > 0) { 278 foreach ($dynamicChunks as $dynamicChunk) { 279 $lastCommentFromDateTime = strtotime($dynamicChunk[count($dynamicChunk) - 1]['date']) * 1000; 280 $countRemainingIfSuccessful = $countRemaining - count($dynamicChunk); 281 $requestBody = json_encode( 282 array( 283 "countRemaining" => $countRemainingIfSuccessful, 284 "comments" => $dynamicChunk 285 ) 286 ); 287 $httpResponse = $this->makeHTTPRequest('POST', "$this->baseUrl/comments?token=$token", $requestBody); 288 $this->log('debug', "Got POST /comments response status code=[$httpResponse->responseStatusCode] and chunk size $dynamicChunkSize"); 289 if ($httpResponse->responseStatusCode === 200) { 290 $response = json_decode($httpResponse->responseBody); 291 if ($response->status === 'success') { 292 $countRemaining = $countRemainingIfSuccessful; 293 $fromDateTime = $lastCommentFromDateTime; 294 $lastSendDate = $fromDateTime; 295 $this->setSettingValue('fastcomments_stream_last_send_timestamp', $fromDateTime); 296 if ($countRemaining <= 0) { 297 $this->setSetupDone(); 298 // break; 299 } 300 } 301 $chunkAttemptsRemaining = 0; // done 302 } else if ($httpResponse->responseStatusCode === 413 && $dynamicChunkSize > 1) { 303 $this->log('debug', "$dynamicChunkSize too big, splitting."); 304 $dynamicChunks = array_chunk($chunk, max((int)($dynamicChunkSize / 10), 1)); 305 break; // break out of the dynamic chunks loop and run it again 290 306 } 291 // } 307 } 308 $chunkAttemptsRemaining--; 292 309 } 293 } else {294 $this->setSetupDone();295 // break;296 310 } 297 311 } else { 298 $status = $getCommentsResponse['status']; 299 $comments = $getCommentsResponse['comments']; 300 $debugHasMore = $getCommentsResponse['hasMore']; 301 $this->log('error', "Failed to get comments to send: status=[$status] comments=[$comments] hasMore=[$debugHasMore]}"); 312 $this->setSetupDone(); 313 // break; 314 } 315 } else { 316 $status = $getCommentsResponse['status']; 317 $comments = $getCommentsResponse['comments']; 318 $debugHasMore = $getCommentsResponse['hasMore']; 319 $this->log('error', "Failed to get comments to send: status=[$status] comments=[$comments] hasMore=[$debugHasMore]}"); 302 320 // break; 303 }321 } 304 322 // } 305 323 $this->log('debug', 'Done sending comments'); -
fastcomments/trunk/fastcomments-wordpress-plugin.php
r2585075 r2586120 4 4 Plugin URI: https://fastcomments.com 5 5 Description: Live Comments, Fast. A comment system that will delight your users and developers. 6 Version: 3.9. 66 Version: 3.9.7 7 7 Author: winrid @ FastComments 8 8 License: GPL-2.0+ … … 14 14 } 15 15 16 $FASTCOMMENTS_VERSION = 3.9 6;16 $FASTCOMMENTS_VERSION = 3.97; 17 17 18 18 require_once plugin_dir_path(__FILE__) . 'admin/fastcomments-admin.php';
Note: See TracChangeset
for help on using the changeset viewer.