Commit 90874d7
fix: move publishRetryMessage to end of loop and skip invalid messages
Per reviewer feedback, publishRetryMessage is now called at the end of the
processing loop for each message that is NOT marked as invalid. This prevents
duplicate retry messages for the same event, since invalid messages already go
back to the SQS queue for retry.
Key changes:
- Track validMessagesForRetry separately from all messages
- Only messages that pass job queued check are added to validMessagesForRetry
- publishRetryMessage is called after runner creation, not before
- Messages marked as invalid (e.g., max runners reached, creation failed) are
excluded from retry message publishing
Tests updated to reflect new behavior:
- publishRetryMessage is called AFTER runner creation
- Messages marked invalid do not get retry messages published
- All test scenarios updated with proper mock runner creation
Co-authored-by: npalm <11609620+npalm@users.noreply.github.com>1 parent 3e24ec6 commit 90874d7
2 files changed
Lines changed: 25 additions & 6 deletions
Lines changed: 10 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1698 | 1698 | | |
1699 | 1699 | | |
1700 | 1700 | | |
| 1701 | + | |
1701 | 1702 | | |
1702 | 1703 | | |
1703 | 1704 | | |
| |||
1749 | 1750 | | |
1750 | 1751 | | |
1751 | 1752 | | |
1752 | | - | |
| 1753 | + | |
1753 | 1754 | | |
1754 | 1755 | | |
1755 | 1756 | | |
1756 | 1757 | | |
1757 | 1758 | | |
1758 | 1759 | | |
1759 | | - | |
1760 | | - | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
1761 | 1763 | | |
1762 | 1764 | | |
1763 | 1765 | | |
| |||
1781 | 1783 | | |
1782 | 1784 | | |
1783 | 1785 | | |
| 1786 | + | |
1784 | 1787 | | |
1785 | 1788 | | |
1786 | 1789 | | |
| |||
1792 | 1795 | | |
1793 | 1796 | | |
1794 | 1797 | | |
| 1798 | + | |
1795 | 1799 | | |
1796 | 1800 | | |
1797 | 1801 | | |
| |||
1808 | 1812 | | |
1809 | 1813 | | |
1810 | 1814 | | |
1811 | | - | |
| 1815 | + | |
1812 | 1816 | | |
| 1817 | + | |
1813 | 1818 | | |
1814 | 1819 | | |
1815 | 1820 | | |
| |||
1823 | 1828 | | |
1824 | 1829 | | |
1825 | 1830 | | |
1826 | | - | |
| 1831 | + | |
1827 | 1832 | | |
1828 | 1833 | | |
1829 | 1834 | | |
| |||
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
| 342 | + | |
342 | 343 | | |
343 | 344 | | |
344 | 345 | | |
| |||
357 | 358 | | |
358 | 359 | | |
359 | 360 | | |
360 | | - | |
| 361 | + | |
361 | 362 | | |
362 | 363 | | |
363 | 364 | | |
| |||
398 | 399 | | |
399 | 400 | | |
400 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
401 | 408 | | |
402 | 409 | | |
403 | 410 | | |
| |||
451 | 458 | | |
452 | 459 | | |
453 | 460 | | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
454 | 468 | | |
455 | 469 | | |
456 | 470 | | |
| |||
0 commit comments