@@ 218-239 (lines=22) @@ | ||
215 | // try to send actions until we run out of things to send, |
|
216 | // or have to wait more than 15s before sending again, |
|
217 | // or we hit a lock or some other sending issue |
|
218 | static function do_cron_sync() { |
|
219 | if ( ! self::sync_allowed() ) { |
|
220 | return; |
|
221 | } |
|
222 | ||
223 | self::initialize_sender(); |
|
224 | ||
225 | do { |
|
226 | $next_sync_time = self::$sender->get_next_sync_time( 'sync' ); |
|
227 | ||
228 | if ( $next_sync_time ) { |
|
229 | $delay = $next_sync_time - time() + 1; |
|
230 | if ( $delay > 15 ) { |
|
231 | break; |
|
232 | } elseif ( $delay > 0 ) { |
|
233 | sleep( $delay ); |
|
234 | } |
|
235 | } |
|
236 | ||
237 | $result = self::$sender->do_sync(); |
|
238 | } while ( $result ); |
|
239 | } |
|
240 | ||
241 | static function do_cron_full_sync() { |
|
242 | if ( ! self::sync_allowed() ) { |
|
@@ 241-262 (lines=22) @@ | ||
238 | } while ( $result ); |
|
239 | } |
|
240 | ||
241 | static function do_cron_full_sync() { |
|
242 | if ( ! self::sync_allowed() ) { |
|
243 | return; |
|
244 | } |
|
245 | ||
246 | self::initialize_sender(); |
|
247 | ||
248 | do { |
|
249 | $next_sync_time = self::$sender->get_next_sync_time( 'full_sync' ); |
|
250 | ||
251 | if ( $next_sync_time ) { |
|
252 | $delay = $next_sync_time - time() + 1; |
|
253 | if ( $delay > 15 ) { |
|
254 | break; |
|
255 | } elseif ( $delay > 0 ) { |
|
256 | sleep( $delay ); |
|
257 | } |
|
258 | } |
|
259 | ||
260 | $result = self::$sender->do_full_sync(); |
|
261 | } while ( $result ); |
|
262 | } |
|
263 | ||
264 | static function initialize_listener() { |
|
265 | require_once dirname( __FILE__ ) . '/class.jetpack-sync-listener.php'; |