Skip to content

Commit

Permalink
#361 rename job component, email load ids waiting for processing: add…
Browse files Browse the repository at this point in the history
… a limit of 100
  • Loading branch information
syjer committed Nov 22, 2018
1 parent f5bbb3b commit 188344b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import java.util.List;

/**
* <p>Scheduled jobs. Important: all the jobs should be able to run on multiple instance at the same time.</p>
* <p>Scheduled jobs. Important: all the jobs must be able to run on multiple instance at the same time.</p>
* <p>Take great care in placing a select id ... for update skip locked to avoid multiple job execution for the same object</p>
*
*/
Expand All @@ -46,7 +46,7 @@
@Profile("!" + Initializer.PROFILE_DISABLE_JOBS)
@AllArgsConstructor
@Log4j2
public class SpringScheduledJobs {
public class Jobs {


private static final int ONE_MINUTE = 1000 * 60;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/alfio/repository/EmailMessageRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int insert(@Bind("eventId") int eventId,
int updateStatusAndAttempts(@Bind("messageId") int messageId, @Bind("status") String status, @Bind("nextDate") Date date, @Bind("attempts") int attempts, @Bind("expectedStatuses") List<String> expectedStatuses);


@Query("select id from email_message where event_id = :eventId and (status = 'WAITING' or status = 'RETRY') and request_ts <= :date for update skip locked")
@Query("select id from email_message where event_id = :eventId and (status = 'WAITING' or status = 'RETRY') and request_ts <= :date limit 100 for update skip locked")
List<Integer> loadIdsWaitingForProcessing(@Bind("eventId") int eventId, @Bind("date") Date date);

@Query("update email_message set status = 'SENT', sent_ts = :sentTimestamp where event_id = :eventId and checksum = :checksum and status in (:expectedStatuses)")
Expand Down

0 comments on commit 188344b

Please sign in to comment.