Replace system request with a null request

This commit is contained in:
Tadgh 2023-04-25 17:37:07 -07:00
parent 9e214154a2
commit f20206ad29
3 changed files with 6 additions and 6 deletions

View File

@ -186,7 +186,7 @@ public class JpaJobPersistenceImpl implements IJobPersistence {
@Nonnull
public Optional<JobInstance> fetchInstance(String theInstanceId) {
return myTransactionService
.withSystemRequest()
.withRequest(null)
.execute(() -> myJobInstanceRepository.findById(theInstanceId).map(this::toInstance));
}
@ -332,7 +332,7 @@ public class JpaJobPersistenceImpl implements IJobPersistence {
private void fetchChunks(String theInstanceId, boolean theIncludeData, int thePageSize, int thePageIndex, Consumer<WorkChunk> theConsumer) {
myTransactionService
.withSystemRequest()
.withRequest(null)
.withPropagation(Propagation.REQUIRES_NEW)
.execute(() -> {
List<Batch2WorkChunkEntity> chunks;
@ -350,7 +350,7 @@ public class JpaJobPersistenceImpl implements IJobPersistence {
@Override
public List<String> fetchAllChunkIdsForStepWithStatus(String theInstanceId, String theStepId, WorkChunkStatusEnum theStatusEnum) {
return myTransactionService
.withSystemRequest()
.withRequest(null)
.withPropagation(Propagation.REQUIRES_NEW)
.execute(() -> myWorkChunkRepository.fetchAllChunkIdsForStepWithStatus(theInstanceId, theStepId, theStatusEnum));
}
@ -422,7 +422,7 @@ public class JpaJobPersistenceImpl implements IJobPersistence {
@Override
public boolean markInstanceAsStatus(String theInstance, StatusEnum theStatusEnum) {
int recordsChanged = myTransactionService
.withSystemRequest()
.withRequest(null)
.execute(()->myJobInstanceRepository.updateInstanceStatus(theInstance, theStatusEnum));
return recordsChanged > 0;
}

View File

@ -123,7 +123,7 @@ public class JobCoordinatorImpl implements IJobCoordinator {
IJobPersistence.CreateResult instanceAndFirstChunk =
myTransactionService.withSystemRequest().execute(() ->
myTransactionService.withRequest(null).execute(() ->
myJobPersistence.onCreateWithFirstChunk(jobDefinition, theStartRequest.getParameters()));
JobWorkNotification workNotification = JobWorkNotification.firstStepNotification(jobDefinition, instanceAndFirstChunk.jobInstanceId, instanceAndFirstChunk.workChunkId);

View File

@ -231,7 +231,7 @@ class WorkChannelMessageHandler implements MessageHandler {
* Run theCallback in TX, rolling back if the supplied Optional is empty.
*/
<T> Optional<T> executeInTxRollbackWhenEmpty(Supplier<Optional<T>> theCallback) {
return myHapiTransactionService.withSystemRequest()
return myHapiTransactionService.withRequest(null)
.execute(theTransactionStatus -> {
// run the processing