diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d4b4dd7..a1eafcd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,7 @@ +stages: + - gateway-build + - web-app-build + include: - local: gateway/.gitlab-ci.yml - local: web-app/.gitlab-ci.yml \ No newline at end of file diff --git a/gateway/.gitlab-ci.yml b/gateway/.gitlab-ci.yml index 9144490..4fddc9d 100644 --- a/gateway/.gitlab-ci.yml +++ b/gateway/.gitlab-ci.yml @@ -5,12 +5,12 @@ default: image: $DOCKER_IMAGE stages: - - build-docker + - gateway-build # This job runs only when Dockerfile changes -docker-build: +gateway-docker-build: image: docker:latest - stage: build-docker + stage: gateway-build services: - docker:dind script: diff --git a/gateway/src/RequestInflux.go b/gateway/src/RequestInflux.go index 0fff1bc..356ef1a 100644 --- a/gateway/src/RequestInflux.go +++ b/gateway/src/RequestInflux.go @@ -63,13 +63,12 @@ func (gh *Gateway) requestInflux(c *gin.Context) error { // The Flux query uses a large range (-1000d) and aggregates the latest values. // This ensures we always get the most recent data, even if the database contains old entries. query := fmt.Sprintf(`from(bucket: %q) - |> range(start: -1000d) + |> range(start: -1d) |> filter(fn: (r) => r["_measurement"] == %q) |> filter(fn: (r) => r["user"] == %q) |> filter(fn: (r) => r["room"] == %q) |> filter(fn: (r) => r["device"] == %q) |> sort(columns: ["_time"], desc: true) - |> limit(n: 100) `, INFLUXDB_BUCKET, MEASUREMENT_NAME, user, room, device) results, err := queryAPI.Query(context.Background(), query) if err != nil { diff --git a/web-app/.gitlab-ci.yml b/web-app/.gitlab-ci.yml index d4977c0..e6b3cba 100644 --- a/web-app/.gitlab-ci.yml +++ b/web-app/.gitlab-ci.yml @@ -5,11 +5,11 @@ default: image: $DOCKER_IMAGE stages: - - build-docker + - web-app-build -docker-build: +web-app-docker-build: image: docker:latest - stage: build-docker + stage: web-app-build services: - docker:dind script: