JIRA SERVER

Problem

Synchronization stuck and errors are constantly generated, whenever the source of the errors is fixed.

Workaround

Run the script below in your browser console. 

This script helps with the All sync is blocked errors being constantly generated on the Instance.

You can change the number 40 to the number of the sync events you have in the queue.

(function attemptResolveErrors(n) {
  if (n > 40) {
    return;
  }
  AJS.$
    .ajax({
      "url": "/rest/issuehub/4.0/errors",
      "contentType":"application/json"
    })
    .then(function(errors, textStatus, jqXHR){
      //var errors = JSON.parse(response.responseText)
      console.log("Got errors: `"+ JSON.stringify(errors) +"`")
      var ps = _.map(errors, function(error){
      AJS.$
        .ajax({
          "url": "/rest/issuehub/4.0/errors/"+error.id+"/resolve",
          "type": "POST",
          "contentType":"application/json"
        })
        //.done(function () { console.log("Error `"+ error.id +"` resolved!") })
        .fail(function(){ console.error(
          "Failed to resolve the error `"+ error.id +"`. Details: "+ JSON.stringify(arguments)); 
        })
      })
      AJS.$.when.apply(AJS.$, ps);
    })
    .fail(function(){ console.error("Failed to get the errors. Details: "+ JSON.stringify(arguments)); })
    .done(function() {
      setTimeout(function(){ attemptResolveErrors(n+1); }, 3000);
    })
})(1);
 

Check the video below for more details