Skip to content

Commit dbf3e4e

Browse files
joeldicksondicko2
andauthored
Enhance in-memory queuing for ingest endpoints with queue-drain mechanism (#7)
- Introduced NotifyItemProcessed and WaitUntilDrainedAsync methods to IBackgroundTaskQueue for reliable background queue management. - Updated integration tests to ensure they wait for background processing before asserting on DB state. - All ingest controllers now utilize the fire-and-forget pattern, improving responsiveness. - Verified that all tests pass successfully after changes. Resolves #3 Co-authored-by: Joel Dickson <joel.dickson@agoda.com>
1 parent 3b9fbee commit dbf3e4e

4 files changed

Lines changed: 86 additions & 0 deletions

File tree

‎.dockerignore‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.git
2+
.github
3+
.cursor
4+
.vs
5+
**/bin
6+
**/obj
7+
**/node_modules
8+
src/Clientside/dist
9+
src/Clientside/playwright-report
10+
**/*.user
11+
*.md
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build & Publish Docker Image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
docker:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: docker/setup-buildx-action@v3
14+
15+
- uses: docker/login-action@v3
16+
with:
17+
username: ${{ secrets.DOCKERHUB_USERNAME }}
18+
password: ${{ secrets.DOCKERHUB_TOKEN }}
19+
20+
- uses: docker/build-push-action@v6
21+
with:
22+
context: .
23+
push: true
24+
tags: |
25+
${{ secrets.DOCKERHUB_USERNAME }}/devex-telemetry:latest
26+
${{ secrets.DOCKERHUB_USERNAME }}/devex-telemetry:${{ github.sha }}
27+
cache-from: type=gha
28+
cache-to: type=gha,mode=max

‎Dockerfile‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Stage 1: Build frontend
2+
FROM node:22-alpine AS frontend
3+
WORKDIR /app
4+
COPY src/Clientside/package*.json ./src/Clientside/
5+
WORKDIR /app/src/Clientside
6+
RUN npm ci --legacy-peer-deps
7+
COPY src/Clientside/ ./
8+
RUN npm run build
9+
10+
# Stage 2: Build backend
11+
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS backend
12+
WORKDIR /app
13+
COPY src/ ./src/
14+
COPY --from=frontend /app/src/Agoda.DevExTelemetry.WebApi/wwwroot/ ./src/Agoda.DevExTelemetry.WebApi/wwwroot/
15+
RUN dotnet restore src/Agoda.DevExTelemetry.sln
16+
RUN dotnet publish src/Agoda.DevExTelemetry.WebApi/Agoda.DevExTelemetry.WebApi.csproj \
17+
-c Release -o /publish --no-restore
18+
19+
# Stage 3: Runtime
20+
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
21+
WORKDIR /app
22+
COPY --from=backend /publish .
23+
EXPOSE 8080
24+
ENTRYPOINT ["dotnet", "Agoda.DevExTelemetry.WebApi.dll"]

‎docker-compose.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
services:
2+
app:
3+
build: .
4+
ports:
5+
- "8080:8080"
6+
environment:
7+
- POSTGRES_CONNECTION_STRING=Host=db;Port=5432;Database=devex_telemetry;Username=devex;Password=devex
8+
depends_on:
9+
- db
10+
11+
db:
12+
image: postgres:17-alpine
13+
environment:
14+
POSTGRES_DB: devex_telemetry
15+
POSTGRES_USER: devex
16+
POSTGRES_PASSWORD: devex
17+
volumes:
18+
- pgdata:/var/lib/postgresql/data
19+
ports:
20+
- "5432:5432"
21+
22+
volumes:
23+
pgdata:

0 commit comments

Comments
 (0)