Skip to content

Commit

Permalink
Insert timeseries even if fromtime is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Lun4m committed Dec 2, 2024
1 parent fa5b74a commit c5046e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
7 changes: 4 additions & 3 deletions migrations/kvalobs/import/cache/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cache
import (
"context"
"database/sql"
"errors"
"log/slog"
"os"
"time"
Expand Down Expand Up @@ -36,8 +35,10 @@ func (c *Cache) GetSeriesTimespan(label *db.Label) (utils.TimeSpan, error) {
return timespan, nil
}

// If there is no timespan we can't insert a new timeseries
return utils.TimeSpan{}, errors.New(label.LogStr() + "No timespan found, cannot create timeseries")
// If there is no timespan we insert null fromtime and totime
// TODO: is this really what we want to do?
// Is there another place where to find this information?
return utils.TimeSpan{}, nil
}

func (c *Cache) TimeseriesIsOpen(stnr, typeid, paramid int32) bool {
Expand Down
5 changes: 0 additions & 5 deletions migrations/lard/timeseries.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package lard

import (
"context"
"errors"
"migrate/utils"

"github.com/jackc/pgx/v5/pgxpool"
Expand Down Expand Up @@ -62,10 +61,6 @@ func GetTimeseriesID(label *Label, timespan utils.TimeSpan, pool *pgxpool.Pool)
}
}

if timespan.From == nil {
return tsid, errors.New("Fromtime should never be null when creating new timeseries")
}

// If none of the above worked insert a new timeseries
transaction, err := pool.Begin(context.TODO())
if err != nil {
Expand Down

0 comments on commit c5046e6

Please sign in to comment.