From 066e210d8abb143fc4fe3b72cb2e6c778a669866 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 1 May 2023 22:07:50 +0200 Subject: [PATCH 1/2] Fixes --- Dockerfile | 2 +- src/ecodash/api.go | 4 ++-- templates/default/admin.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5de92d7..47f94d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,6 @@ WORKDIR /app COPY --from=1 /app/app . COPY ./templates /app/templates -RUN touch config.json +RUN touch config.json database.db CMD ["./app"] \ No newline at end of file diff --git a/src/ecodash/api.go b/src/ecodash/api.go index e517a1c..923a0f5 100644 --- a/src/ecodash/api.go +++ b/src/ecodash/api.go @@ -27,7 +27,8 @@ func dayStart(t time.Time) time.Time { var errNon200 = errors.New("got a non-200 status code. Check the correctness of sensors IDs") func (config *Config) queryHistory(entityID string, startTime, endTime time.Time) (HistoryResult, error) { - ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() req, err := http.NewRequestWithContext( ctx, http.MethodGet, @@ -40,7 +41,6 @@ func (config *Config) queryHistory(entityID string, startTime, endTime time.Time ), http.NoBody, ) - cancel() if err != nil { return HistoryResult{}, err } diff --git a/templates/default/admin.html b/templates/default/admin.html index 9d6034a..14654a2 100644 --- a/templates/default/admin.html +++ b/templates/default/admin.html @@ -19,7 +19,7 @@

HomeAssistant

- + Installation date

Sensors

From 9423b578b8adcdce46615d7fc761171006cf05ad Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 1 May 2023 22:16:14 +0200 Subject: [PATCH 2/2] Increase timeout --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index cb1b86a..c128eff 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,7 +1,7 @@ # options for analysis running run: # timeout for analysis, e.g. 30s, 5m, default is 1m - timeout: 10m + timeout: 30m # output configuration options output: