Skip to content

Commit 3e48ea6

Browse files
committed
fix: add DB container startup retry and wire QueryBuilder offset()
The SQL Server CI test failures were caused by Docker container startup flakiness (Step 5: "Start external DB"), not code issues. Add retry logic (3 attempts with cleanup) for external DB container startup. Also fix QueryBuilder.offset() which stored the value but never passed it to finder args. Now uses Wheels internal $limit/$offset parameters for precise row-range control across all database engines. https://claude.ai/code/session_01TYLbmcU97RcvZUDdyUfS1t
1 parent 6fc556f commit 3e48ea6

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

.github/workflows/tests.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,26 @@ jobs:
149149

150150
- name: Start external DB if needed (${{ matrix.dbengine }}) ...
151151
if: ${{ matrix.dbengine != 'h2' && matrix.dbengine != 'sqlite'}}
152-
run: docker compose up -d ${{ matrix.dbengine }}
152+
run: |
153+
MAX_RETRIES=3
154+
RETRY_COUNT=0
155+
while [ "$RETRY_COUNT" -lt "$MAX_RETRIES" ]; do
156+
RETRY_COUNT=$((RETRY_COUNT + 1))
157+
echo "Attempt $RETRY_COUNT of $MAX_RETRIES: Starting ${{ matrix.dbengine }}..."
158+
if docker compose up -d ${{ matrix.dbengine }}; then
159+
echo "✅ ${{ matrix.dbengine }} container started successfully"
160+
exit 0
161+
else
162+
echo "❌ Failed to start ${{ matrix.dbengine }} on attempt $RETRY_COUNT"
163+
if [ "$RETRY_COUNT" -lt "$MAX_RETRIES" ]; then
164+
echo "Cleaning up and retrying in 10 seconds..."
165+
docker compose down ${{ matrix.dbengine }} 2>/dev/null || true
166+
sleep 10
167+
fi
168+
fi
169+
done
170+
echo "Failed to start ${{ matrix.dbengine }} after $MAX_RETRIES attempts"
171+
exit 1
153172
154173
- name: Wait for containers to be ready
155174
run: |

vendor/wheels/model/query/QueryBuilder.cfc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,12 @@ component output="false" {
269269
local.args.distinct = true;
270270
}
271271

272-
// Apply LIMIT
273-
if (variables.limitValue > 0) {
272+
// Apply LIMIT and OFFSET
273+
if (variables.offsetValue > 0 && variables.limitValue > 0) {
274+
// Use internal limit/offset for precise row-range control (works on all DB engines)
275+
local.args.$limit = variables.limitValue;
276+
local.args.$offset = variables.offsetValue;
277+
} else if (variables.limitValue > 0) {
274278
local.args.maxRows = variables.limitValue;
275279
}
276280

0 commit comments

Comments
 (0)