Commit c523dc3
committed
fix(sqs/htfifo): address PR #681 review feedback (Gemini medium x3)
Three medium-priority Gemini findings + one cyclop fix from the
rebase onto the updated PR #679 throttling branch.
(1) sqsErrInvalidParameterValue removed (sqs_catalog.go,
sqs_partitioning.go, sqs_partitioning_test.go): the constant
duplicated sqsErrValidation which already carries
"InvalidParameterValue". Reuses the existing constant; comment on
the validator clarifies the choice.
(2) snapshotImmutableHTFIFO heap allocation gated on
htfifoAttributesPresent (sqs_catalog.go): the snapshot is only
needed when the request actually carries an HT-FIFO attribute. A
SetQueueAttributes that touches only mutable attributes (e.g.
VisibilityTimeout — the common path) now skips the allocation
entirely. The validator short-circuit on preApply == nil keeps
correctness identical: a request with no HT-FIFO attribute can
never change an HT-FIFO field.
(3) partitionFor inlined FNV-1a (sqs_partitioning.go): the
hash/fnv.New64a + h.Write([]byte(messageGroupID)) path heap-
allocates the byte slice and pays the hash.Hash interface dispatch
on every SendMessage. Replaced with a manual FNV-1a loop over the
string — measurably faster on the routing hot path. MessageGroupId
is capped at 128 chars by validation so the loop is bounded.
(4) cyclop (trySetQueueAttributesOnce): the conditional preApply
branch + immutability check + Throttle validator pushed cyclop to
12. Extracted applyAndValidateSetAttributes so the function stays
under the ceiling; the helper is also useful for any future
admin-surface callers that want the same apply+validate flow
without the OCC dispatch.
All tests pass under -race; golangci-lint clean.1 parent d46d4da commit c523dc3
3 files changed
Lines changed: 59 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | 63 | | |
70 | 64 | | |
71 | 65 | | |
| |||
1376 | 1370 | | |
1377 | 1371 | | |
1378 | 1372 | | |
1379 | | - | |
1380 | | - | |
1381 | | - | |
1382 | | - | |
1383 | | - | |
1384 | | - | |
1385 | | - | |
1386 | | - | |
1387 | | - | |
1388 | | - | |
1389 | | - | |
1390 | | - | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
1391 | 1387 | | |
1392 | | - | |
1393 | | - | |
1394 | | - | |
1395 | | - | |
1396 | | - | |
1397 | | - | |
1398 | | - | |
1399 | 1388 | | |
1400 | | - | |
| 1389 | + | |
1401 | 1390 | | |
1402 | | - | |
1403 | | - | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
1404 | 1395 | | |
1405 | 1396 | | |
1406 | 1397 | | |
1407 | 1398 | | |
1408 | 1399 | | |
1409 | | - | |
| 1400 | + | |
1410 | 1401 | | |
1411 | 1402 | | |
1412 | 1403 | | |
1413 | 1404 | | |
1414 | 1405 | | |
1415 | | - | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
1416 | 1423 | | |
1417 | 1424 | | |
1418 | 1425 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
83 | | - | |
84 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
85 | 97 | | |
86 | 98 | | |
87 | 99 | | |
88 | 100 | | |
89 | 101 | | |
90 | | - | |
| 102 | + | |
91 | 103 | | |
92 | 104 | | |
93 | 105 | | |
| |||
140 | 152 | | |
141 | 153 | | |
142 | 154 | | |
143 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
144 | 159 | | |
145 | 160 | | |
146 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
191 | | - | |
| 190 | + | |
| 191 | + | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| |||
0 commit comments