Merge branch 'fix/notification-tryclaim-modifying' into 'main'
fix(notifications): tryClaim drop @Modifying — unblocks ALL dispatch See merge request 2-6/2-6-4/terravault/ordinis!215
This commit is contained in:
+10
-1
@@ -21,8 +21,17 @@ public interface NotificationLogRepository extends JpaRepository<NotificationLog
|
|||||||
* (другой consumer уже claim'ил, или sweep job не освободил stuck row).
|
* (другой consumer уже claim'ил, или sweep job не освободил stuck row).
|
||||||
*
|
*
|
||||||
* <p>Используется в {@code IdempotencyGuard.shouldSend()}.
|
* <p>Используется в {@code IdempotencyGuard.shouldSend()}.
|
||||||
|
*
|
||||||
|
* <p><b>Без</b> {@code @Modifying} — native INSERT с RETURNING clause работает
|
||||||
|
* как SELECT-shaped query (returns 0..1 rows). {@code @Modifying} ограничивает
|
||||||
|
* return type до {@code void/int/Integer}, что несовместимо с {@code Optional<Long>}
|
||||||
|
* → Spring Data JPA throws InvalidDataAccessApiUsageException на каждом
|
||||||
|
* dispatcher tick. Bug history: {@code @Modifying} добавили cargo-cult'ом
|
||||||
|
* (INSERT ⇒ mutating), but native + RETURNING — read-shaped в JPA model.
|
||||||
|
* Эта misconfiguration блокировала весь dispatch pipeline — пока race
|
||||||
|
* не был fix'нут в MR !214, ошибка вообще не surface'илась (events не
|
||||||
|
* doходили до tryClaim).
|
||||||
*/
|
*/
|
||||||
@Modifying
|
|
||||||
@Query(value = """
|
@Query(value = """
|
||||||
INSERT INTO notification_log (event_id, event_type, draft_id, channel, recipient, status, sent_at)
|
INSERT INTO notification_log (event_id, event_type, draft_id, channel, recipient, status, sent_at)
|
||||||
VALUES (:eventId, :eventType, :draftId, :channel, :recipient, 'PENDING', NOW())
|
VALUES (:eventId, :eventType, :draftId, :channel, :recipient, 'PENDING', NOW())
|
||||||
|
|||||||
Reference in New Issue
Block a user