fix: add missing error handling
This commit is contained in:
parent
749f2697c7
commit
9207833a71
@ -891,6 +891,10 @@ func (d *Postgres) Import(ctx context.Context, src Repository) error {
|
||||
}
|
||||
|
||||
sensors, err := src.GetSensors(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = d.insertOrUpdateSensors(tx, sensors...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -921,6 +921,9 @@ func (d *SQLite) GetTemperatures(ctx context.Context) ([]*types.MeasuredValue, e
|
||||
// Import imports devices, sensors and all measured values from a source
|
||||
// repository. Existing entries will be updated.
|
||||
func (d *SQLite) Import(ctx context.Context, src Repository) error {
|
||||
d.mutex.Lock()
|
||||
defer d.mutex.Unlock()
|
||||
|
||||
tx, err := d.dbo.BeginTx(ctx, &sql.TxOptions{ReadOnly: false})
|
||||
if err != nil {
|
||||
return err
|
||||
@ -938,6 +941,10 @@ func (d *SQLite) Import(ctx context.Context, src Repository) error {
|
||||
}
|
||||
|
||||
sensors, err := src.GetSensors(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = d.insertOrUpdateSensors(tx, sensors...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user