• Resolved r-a-y

    (@r-a-y)


    Hi,

    We noticed that in the latest update, usage tracking was added as a feature and utilizes the Action Scheduler library to send usage data back to the developer.

    While it is nice that usage tracking is opt-in by default, the Action Scheduler library runs all the time, which isn’t great from a cron perspective or for sites that run alternative WordPress scheduling job systems like Cavalcade on relatively, large multisite networks.

    We would recommend to only initialize Action Scheduler if usage tracking is enabled.

    Let me know if you need any further feedback from us.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter r-a-y

    (@r-a-y)

    I looked into disabling Action Scheduler if usage tracking is enabled, but it’s not a simple thing.

    You’d have to add something like this to the main pdf-embedder.php file:

    add_filter(
    	'action_scheduler_queue_runner_class',
    	function( $retval ) {
    		// Do check for usage tracking option.
    		if ( ! USAGE_TRACKING ) {
    			// Register dummy class for AS.
    			// Could also check to see if other AS tasks are registered by other plugins before doing this.
    			return 'PDFEmbedderDisableAS';
    		}
    	}
    );
    
    
    /**
     * Sigh...
     */
    class PDFEmbedderDisableAS {
    	public function init() {}
    }

    Plugin Author Slava Abakumov

    (@slaffik)

    Hey @r-a-y

    That’s a great suggestion.

    Yeah, I agree that the possible solution you suggested is quite dirty. I will take a look at what else can be done in order to control whether the AS is needed at all.

    Thank you for raising this topic!

    Plugin Author Slava Abakumov

    (@slaffik)

    I hope to include the fix into the next PDF Embedder release.

    Basically, I want to not load the whole library from within my own plugin when the usage tracking is disabled.

    • This reply was modified 7 months, 2 weeks ago by Slava Abakumov. Reason: adjusted the wording after additional testing and newly found edge cases
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Limit Action Scheduler to only run if usage tracking is enabled’ is closed to new replies.