Skip to content

Commit e751d9a

Browse files
authored
Merge pull request #186 from bcgov/dev
Dev To Test 2026-04-28
2 parents 0ee809d + 0c896e8 commit e751d9a

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

applications/Grants.ApplicantPortal/src/Grants.ApplicantPortal.Backend/src/Grants.ApplicantPortal.API.Infrastructure/Messaging/Jobs/InboxProcessorJob.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ public async Task Execute(IJobExecutionContext context)
7373

7474
try
7575
{
76-
// First, release any expired locks
77-
await _inboxRepository.ReleaseExpiredLocksAsync(cancellationToken);
78-
7976
// Acquire distributed lock to ensure only one instance processes messages
8077
var lockResult = await _distributedLock.AcquireLockAsync(_lockKey, _lockDuration, TimeSpan.FromSeconds(5), cancellationToken);
8178

@@ -96,6 +93,9 @@ public async Task Execute(IJobExecutionContext context)
9693

9794
try
9895
{
96+
// Release any expired application-level inbox message locks (only the pod that won the distributed lock does this)
97+
await _inboxRepository.ReleaseExpiredLocksAsync(cancellationToken);
98+
9999
var processed = 0;
100100
var startTime = DateTime.UtcNow;
101101

applications/Grants.ApplicantPortal/src/Grants.ApplicantPortal.Backend/src/Grants.ApplicantPortal.API.Infrastructure/Messaging/Jobs/OutboxProcessorJob.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ public async Task Execute(IJobExecutionContext context)
5858

5959
try
6060
{
61-
// First, release any expired locks
62-
await _outboxRepository.ReleaseExpiredLocksAsync(cancellationToken);
63-
6461
// Acquire distributed lock to ensure only one instance processes messages
6562
var lockResult = await _distributedLock.AcquireLockAsync(_lockKey, _lockDuration, TimeSpan.FromSeconds(5), cancellationToken);
6663

@@ -81,6 +78,9 @@ public async Task Execute(IJobExecutionContext context)
8178

8279
try
8380
{
81+
// Release any expired message processing locks (only the pod that won the distributed lock does this)
82+
await _outboxRepository.ReleaseExpiredLocksAsync(cancellationToken);
83+
8484
var processed = 0;
8585
var startTime = DateTime.UtcNow;
8686

0 commit comments

Comments
 (0)