public TimelineEvent unblock(String workflowId, User caller) {
    TimelineActionEvent.TimelineActionEventBuilder eventBuilder =
        TimelineActionEvent.builder().author(caller).reason("Unblock workflow [%s]", workflowId);
    int totalUnblocked = 0;
    int unblocked = Constants.UNBLOCK_BATCH_SIZE;
    while (unblocked == Constants.UNBLOCK_BATCH_SIZE) {
      unblocked =
          instanceDao.tryUnblockFailedWorkflowInstances(
              workflowId, Constants.UNBLOCK_BATCH_SIZE, eventBuilder.build());
      totalUnblocked += unblocked;
    }
    workflowHelper.publishStartWorkflowEvent(workflowId, totalUnblocked > 0);
    return eventBuilder
        .message("Unblocked [%s] failed workflow instances.", totalUnblocked)
        .build();
  }
@Test
  public void testUnblockReachingLimit() {
    when(instanceDao.tryUnblockFailedWorkflowInstances(eq("sample-minimal-wf"), anyInt(), any()))
        .thenReturn(Constants.UNBLOCK_BATCH_SIZE)
        .thenReturn(10);
    TimelineEvent event = actionHandler.unblock("sample-minimal-wf", tester);
    assertEquals("Unblocked [110] failed workflow instances.", event.getMessage());
    verify(maestroJobEventPublisher, times(1)).publishOrThrow(any(StartWorkflowJobEvent.class));
  }