Title: Plugin stops running after a while
Last modified: January 18, 2022

---

# Plugin stops running after a while

 *  [lagzer](https://wordpress.org/support/users/lagzer/)
 * (@lagzer)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/plugin-stops-running-after-a-while/)
 * Hello, first of all, thanks for a great and versatile plugin that overall works
   very well and is both easy to setup as well as manage programatically.
 * I am running a multisite that has worked very well with your plugin for months.
   I had to renew my Salesforce Certificates (un Certificate and Key management)
   in early October, 2021, when one of the sites started to have an issue that the
   plugin would stop syncing.
 * When I change the time under the “Pull from Salesforce” (Schedule-tab) in the“
   Run schedule every” input field and save it starts again, but unfortunately it
   stops again after some time. It seemed to go better out of it self after some
   time and me trying to disconnect and reconnect a few times.
 * Recently I moved servers and now 4 or 5 sites seem to have the same issue, and
   no matter if I disconnect and reconnect the issue remains. I can still change
   the Schedule time to start it up again.
 * When the plugin is syncing it does connect as it should and pulls and pushes 
   data. After a while, in no pattern in terms of time, sometimes it takes 4 hours
   and sometimes it takes 3 days or even longer, the syncing stops. It also doesn’t
   stop at the same time on the different sites.
 * In the Scheduled action page I find that the Hook “object_sync_for_salesforce_pull_check_records”
   has status “Failed”, and then hasn’t continued, even though the Recurrence is
   says “Every two minutes”.
 * I am looking in the log (I turned on debug mode in the plugin settings) but can’t
   find anything suspicious, though it’s a lot of information and I don’t really
   know what I’m looking for, so potentially I’m missing something.
 * I also turned on the debug mode and debug log in WordPress, though I’m not sure
   the errors from the Scheduled action would show up in there. Looking at the logs
   I can’t find any commonalities at the time of the errors besides some PHP notices
   that also happens when the plugin isn’t stopping.
 * Has anyone had the same issue and if so can you shine some light at this situation?
 * Thanks in advance!
 * Best,
    Andreas

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Jonathan Stegall](https://wordpress.org/support/users/jonathanstegall/)
 * (@jonathanstegall)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/plugin-stops-running-after-a-while/#post-15264336)
 * When you turn on debug mode, do you find that the plugin is still running the
   tasks that it’s supposed to run, or have those tasks stopped? I’m asking because
   if the tasks no longer run (to check for updated data in Salesforce, for example),
   it could be that Action Scheduler is having problems, or that cron on your server
   is having problems.
 *  Thread Starter [lagzer](https://wordpress.org/support/users/lagzer/)
 * (@lagzer)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/plugin-stops-running-after-a-while/#post-15269364)
 * Thank you for getting back to me so quickly.
 * Once the Scheduled Action failed, the logs also stop indeed and there are no 
   more action named “object_sync_for_salesforce_pull_check_records”.
 * It could very well be that Action Scheduler has issues. I don’t really get any
   feedback from that.
 * I flushed my Cache on the server, thinking that might be causing the issue after
   the server transfer and new setting.
 * I’m thinking about adding the wp-cron as a run action in the server cron. Perhaps
   that helps, or at least doesn’t stop if it fails a single time.
 *  Thread Starter [lagzer](https://wordpress.org/support/users/lagzer/)
 * (@lagzer)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/plugin-stops-running-after-a-while/#post-15341384)
 * Hello, I’m getting back with an update on this. I have since my previous message
   about three weeks ago cleared the dynamic cache on the server. Although that 
   certainly improved the situation and rather having it stop a couple of times 
   a day they all were running for 3, 4 or even 5 days without failing. It certainly
   seems like the cache purge helped, but still didn’t quite solve the problem.
 * I have now disabled the CRON jobs all together by adding
 * `define('DISABLE_WP_CRON', true);`
 * in the wp-config.php file and have set up a real CRON on the server that executes
   all WordPress CRON/scheduled jobs, per advice from the Web host support. That
   seems to be working well so far.
 * I’ll let you know if the problems remain, but this feels quite robust and hoping
   that this is the solution.
    -  This reply was modified 4 years, 3 months ago by [lagzer](https://wordpress.org/support/users/lagzer/).
 *  Plugin Author [Jonathan Stegall](https://wordpress.org/support/users/jonathanstegall/)
 * (@jonathanstegall)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/plugin-stops-running-after-a-while/#post-15341863)
 * This is helpful. I’m not an expert on cron, but any means, but there is possibly
   some relevant info on the Action Scheduler website here: [https://actionscheduler.org/faq/](https://actionscheduler.org/faq/).
   They mention that it is fine to run Action Scheduler without WP-Cron, so I’m 
   inclined to think you’ll be fine with this.
 *  Thread Starter [lagzer](https://wordpress.org/support/users/lagzer/)
 * (@lagzer)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/plugin-stops-running-after-a-while/#post-15350688)
 * Hello again!
    Do I understand correctly that the Action Scheduler works independently
   from CRON-jobs?
 * Further update on my situation: I have now run the server CRON-jobs and it still
   seems to stop every now and then, however, the situation looks a bit different.
 * Whereas, I before received a “Failed” status and I had to go and change the Schedule
   interval (see more detailed info in my original post), I now don’t see anything
   going wrong but it stops. And it took a while to figure out because when people
   told me something went wrong and I looked it immediately worked, I didn’t do 
   any actions.
 * I soon realized that what I needed to do was to simply log into the WP-backend
   and everything synced right away. Strange behaviour.
 * I have been in contact with the Host support and they sent me a log of the CRON
   jobs and it does run as expected without any errors.
 * I’m not sure if there is anything I can try here. Let me know if this gives anyone
   any direction.
 * My next thing to test is to create a file that doesn’t try to run the schedule
   but simply performs a manual pull from Salesforce.
 * I noticed that I possibly can use `Object_Sync_Sf_Salesforce_Pull`.
 * I’m thinking about setting up a file doing something like this and run it every
   two min from the Server CRON:
 *     ```
       define( 'WP_USE_THEMES', true ); // I think I need this to get the plugin environment
        require_once( $_SERVER[ 'DOCUMENT_ROOT' ] . '/wp-load.php' ); 
       Object_Sync_Sf_Salesforce_Pull();
       ```
   
 * Or perhaps I can use the web hook or the WP REST API to do it.
 * How would you recommend going about that?
 * Thanks in advance!
 * Best,
    Andreas
 *  Plugin Author [Jonathan Stegall](https://wordpress.org/support/users/jonathanstegall/)
 * (@jonathanstegall)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/plugin-stops-running-after-a-while/#post-15350978)
 * So Action Scheduler as a library is, according to their own documentation, capable
   of working independently of WP-Cron. That means you’d have to have some other
   scheduling system set up to interact with it. I don’t have any experience with
   doing this, but they do indicate that it has been done.
 * I would definitely not run `Object_Sync_Sf_Salesforce_Pull` on a schedule; that
   is a whole class and running it without a method specified wouldn’t necessarily
   do anything. What the plugin does with Action Scheduler is run two methods of
   that class at the intervals you configure: `salesforce_pull` and `salesforce_pull_process_records`.
   I imagine it’s probably possible to do this without Action Scheduler, but certainly
   it wasn’t built for that.
 * In any case, to me this sounds like an issue with your host more than an issue
   with this plugin. Building custom solutions to get around that is beyond the 
   kind of support I can provide.
 *  Thread Starter [lagzer](https://wordpress.org/support/users/lagzer/)
 * (@lagzer)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/plugin-stops-running-after-a-while/#post-15352453)
 * Hello! Thanks again for getting back to me so quickly!
 * Sorry I didn’t mean I would call the whole class like that, I was trying to illustrate
   the idea. 🙂
 * That’s helpful! Are there any other actions or commands that triggers a pull 
   in a more conventional way? Is it for instance possible to do it through the 
   WP REST API?
 * Looks like `salesforce_pull` is a more general call, but what’s `salesforce_pull_process_records`?
   How would that be used, if you don’t mind me asking?
 * It could very well be the hosting. Though it worked for really long until we 
   renewed our self signed certificates in Salesforce. Then we started having this
   issue. However, since we moved servers we certainly have a lot more issues with
   it.
 * Thanks a lot for your patience and all your help!
 * Best,
    Andreas

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Plugin stops running after a while’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/object-sync-for-salesforce.svg)
 * [Object Sync for Salesforce](https://wordpress.org/plugins/object-sync-for-salesforce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/object-sync-for-salesforce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/object-sync-for-salesforce/)
 * [Active Topics](https://wordpress.org/support/plugin/object-sync-for-salesforce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/object-sync-for-salesforce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/object-sync-for-salesforce/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [lagzer](https://wordpress.org/support/users/lagzer/)
 * Last activity: [4 years, 3 months ago](https://wordpress.org/support/topic/plugin-stops-running-after-a-while/#post-15352453)
 * Status: not resolved