This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 4c6b4b115 fix(alert): keep the bulk delivery retry going when one id
fails unexpectedly (#5938)
4c6b4b115 is described below
commit 4c6b4b1152f1662211a534ad9e8453ba0010d941
Author: 烤化の初雪 <[email protected]>
AuthorDate: Fri Nov 27 12:17:52 2026 +0800
fix(alert): keep the bulk delivery retry going when one id fails
unexpectedly (#5938)
---
.../studio/ops/alert/NotificationOutboxService.java | 8 ++++++++
.../ops/alert/NotificationOutboxServiceTest.java | 21 +++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git
a/server/src/main/java/org/apache/rocketmq/studio/ops/alert/NotificationOutboxService.java
b/server/src/main/java/org/apache/rocketmq/studio/ops/alert/NotificationOutboxService.java
index 8df8a33c5..57d33fb64 100644
---
a/server/src/main/java/org/apache/rocketmq/studio/ops/alert/NotificationOutboxService.java
+++
b/server/src/main/java/org/apache/rocketmq/studio/ops/alert/NotificationOutboxService.java
@@ -293,6 +293,14 @@ public class NotificationOutboxService {
succeeded.add(deliveryId);
} catch
(org.apache.rocketmq.studio.common.exception.BusinessException error) {
failures.put(deliveryId, error.getMessage());
+ } catch (RuntimeException error) {
+ // Each id was already committed by its own update, so an
unexpected failure on one
+ // row must not discard the outcome of the ids before it (the
loop's whole purpose):
+ // record it and keep going, the way every other per-item loop
in this codebase does.
+ log.warn("Retrying notification delivery {} failed
unexpectedly: {}",
+ deliveryId, error.getMessage());
+ failures.put(deliveryId, error.getMessage() == null
+ ? error.getClass().getSimpleName() :
error.getMessage());
}
}
return new NotificationDeliveryBulkRetryResult(succeeded, failures);
diff --git
a/server/src/test/java/org/apache/rocketmq/studio/ops/alert/NotificationOutboxServiceTest.java
b/server/src/test/java/org/apache/rocketmq/studio/ops/alert/NotificationOutboxServiceTest.java
index 6bec56765..c45fe1c64 100644
---
a/server/src/test/java/org/apache/rocketmq/studio/ops/alert/NotificationOutboxServiceTest.java
+++
b/server/src/test/java/org/apache/rocketmq/studio/ops/alert/NotificationOutboxServiceTest.java
@@ -696,6 +696,27 @@ class NotificationOutboxServiceTest {
assertThat(result.getFailures()).containsKey(9L);
}
+ @Test
+ void
bulkRetryKeepsTheOutcomeOfEarlierDeliveriesWhenALaterOneFailsUnexpectedlyTest()
{
+ RmqAlertNotificationOutboxMapper mapper =
mock(RmqAlertNotificationOutboxMapper.class);
+ RmqAlertNotificationOutbox failed = new RmqAlertNotificationOutbox();
+ failed.setId(8L);
+ failed.setStatus(NotificationOutboxStatus.FAILED.name());
+ when(mapper.selectById(8L)).thenReturn(failed);
+ when(mapper.update(org.mockito.ArgumentMatchers.isNull(),
any(UpdateWrapper.class))).thenReturn(1);
+ when(mapper.selectById(9L))
+ .thenThrow(new
org.springframework.dao.DataAccessResourceFailureException("db down"));
+
+ NotificationDeliveryBulkRetryResult result = new
NotificationOutboxService(mapper,
+ mock(SettingsRepository.class),
mock(AlertSilenceService.class), mock(AlertRepository.class),
+
mock(OperationAuditService.class)).retryFailedDeliveries(List.of(8L, 9L));
+
+ // Delivery 8 was already committed as PENDING; a database failure on
9 must not turn the
+ // whole request into an error that hides that.
+ assertThat(result.getSucceededIds()).containsExactly(8L);
+ assertThat(result.getFailures()).containsKey(9L);
+ }
+
@Test
void bulkRetryRejectsNullIdsBeforeRetryingAnyDeliveryTest() {
RmqAlertNotificationOutboxMapper mapper =
mock(RmqAlertNotificationOutboxMapper.class);