@@ -67,7 +67,7 @@ class Sync_Queue {
6767 *
6868 * @var array
6969 */
70- public $ queue_threads ;
70+ public $ queue_threads = array () ;
7171
7272 /**
7373 * Holds all the threads.
@@ -101,20 +101,31 @@ public function __construct( \Cloudinary\Plugin $plugin ) {
101101 * @param Sync $sync The sync instance.
102102 */
103103 public function setup ( $ sync ) {
104- $ this ->sync = $ sync ;
105- $ queue_threads_count = $ this ->plugin ->settings ->get_value ( 'bulksync_threads ' );
106- $ queue_threads = array ();
104+ $ this ->sync = $ sync ;
105+ /**
106+ * Filter the amount of threads to process background syncing.
107+ *
108+ * @param int $threads The number of threads.
109+ *
110+ * @return int
111+ */
112+ $ queue_threads_count = apply_filters ( 'cloudinary_queue_threads ' , 2 );
107113 for ( $ i = 0 ; $ i < $ queue_threads_count ; $ i ++ ) {
108- $ queue_threads [] = 'queue_sync_thread_ ' . $ i ;
114+ $ this -> queue_threads [] = 'queue_sync_thread_ ' . $ i ;
109115 }
110- $ this ->queue_threads = apply_filters ( 'cloudinary_queue_threads ' , $ queue_threads );
111- $ autosync_threads_count = $ this ->plugin ->settings ->get_value ( 'autosync_threads ' );
112- $ autosync_threads = array ();
113- for ( $ i = 0 ; $ i < $ autosync_threads_count ; $ i ++ ) {
114- $ autosync_threads [] = 'auto_sync_thread_ ' . $ i ;
116+
117+ /**
118+ * Filter the amount of background threads to process for auto syncing.
119+ *
120+ * @param int $threads The number of threads.
121+ *
122+ * @return int
123+ */
124+ $ autosync_thread_count = apply_filters ( 'cloudinary_autosync_threads ' , 1 );
125+ for ( $ i = 0 ; $ i < $ autosync_thread_count ; $ i ++ ) {
126+ $ this ->autosync_threads [] = 'auto_sync_thread_ ' . $ i ;
115127 }
116- $ this ->autosync_threads = apply_filters ( 'cloudinary_autosync_threads ' , $ autosync_threads );
117- $ this ->threads = array_merge ( $ this ->queue_threads , $ this ->autosync_threads );
128+ $ this ->threads = array_merge ( $ this ->queue_threads , $ this ->autosync_threads );
118129
119130 // Catch Queue actions.
120131 // Enable sync queue.
0 commit comments