Digest Email plugin broke in DistributedMutex.synchronize on upgrade

We have a custom digest email plugin which broke when I upgraded from 2.9.0 beta 7 to beta 9. I realize Discourse doesn’t support custom plugins but any clues what I can do before heading over to #marketplace?

Error Log
/var/www/discourse/plugins/discourse-506investor-digest-plugin/plugin.rb:27:in `block in execute'
/var/www/discourse/lib/distributed_mutex.rb:57:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:53:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:53:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:38:in `synchronize'
/var/www/discourse/plugins/discourse-506investor-digest-plugin/plugin.rb:12:in `execute'
/var/www/discourse/app/jobs/base.rb:237:in `block (2 levels) in perform'
rails_multisite-4.0.1/lib/rails_multisite/connection_management.rb:80:in `with_connection'
/var/www/discourse/app/jobs/base.rb:226:in `block in perform'
/var/www/discourse/app/jobs/base.rb:222:in `each'
/var/www/discourse/app/jobs/base.rb:222:in `perform'
/var/www/discourse/app/jobs/base.rb:284:in `perform'
mini_scheduler-0.14.0/lib/mini_scheduler/manager.rb:93:in `process_queue'
mini_scheduler-0.14.0/lib/mini_scheduler/manager.rb:37:in `block (2 levels) in initialize'
Relevant Code
after_initialize {
  class ::Jobs::EnqueueDigestEmails
    def execute(args)
      return if SiteSetting.disable_digest_emails? || SiteSetting.private_email?

      DistributedMutex.synchronize("custom_digest", validity: 180.minutes) {  # <<<<< offending line 12
        users = User.where(id: target_user_ids)
        return if users.blank?
        
        connection = CustomDigest.create_connection

Maybe look at the job that you’re overriding in core and look at blame to see if something there changed recently. That would be my first thing to check.

1 Like