fix batch intermittent and status update atomicity (#3773)
* fix intermittent and status update atomicity * change log Co-authored-by: Ken Stevens <ken@smilecdr.com>
This commit is contained in:
parent
61d34ab695
commit
839a1b53e9
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
type: fix
|
||||
issue: 3773
|
||||
title: "A batch2 state change regression was introduced recently that resulted in batch2 jobs not being properly
|
||||
completed. This has been corrected."
|
|
@ -34,7 +34,7 @@ import java.util.Set;
|
|||
public interface IBatch2JobInstanceRepository extends JpaRepository<Batch2JobInstanceEntity, String>, IHapiFhirJpaRepository {
|
||||
|
||||
@Modifying
|
||||
@Query("UPDATE Batch2JobInstanceEntity e SET e.myStatus = :status WHERE e.myId = :id")
|
||||
@Query("UPDATE Batch2JobInstanceEntity e SET e.myStatus = :status WHERE e.myId = :id and e.myStatus <> :status")
|
||||
int updateInstanceStatus(@Param("id") String theInstanceId, @Param("status") StatusEnum theStatus);
|
||||
|
||||
@Modifying
|
||||
|
|
|
@ -402,7 +402,8 @@ public class JpaJobPersistenceImplTest extends BaseJpaR4Test {
|
|||
public void testMarkInstanceAsCompleted() {
|
||||
String instanceId = mySvc.storeNewInstance(createInstance());
|
||||
|
||||
mySvc.markInstanceAsCompleted(instanceId);
|
||||
assertTrue(mySvc.markInstanceAsCompleted(instanceId));
|
||||
assertFalse(mySvc.markInstanceAsCompleted(instanceId));
|
||||
|
||||
runInTransaction(() -> {
|
||||
Batch2JobInstanceEntity entity = myJobInstanceRepository.findById(instanceId).orElseThrow(() -> new IllegalArgumentException());
|
||||
|
|
Loading…
Reference in New Issue