Keep one reading when two paths are measured at one moment, rather than failing the machine's record (hq issue 368 review)
This commit is contained in:
@@ -195,7 +195,8 @@ func (i *Inventory) RecordData(ctx context.Context, machine string, declared []D
|
||||
where d.machine = $1 and d.module = $2 and d.item = $3
|
||||
and not exists (select 1 from data_reading
|
||||
where machine = $1 and module = $2 and item = $3 and path = d.path
|
||||
and at > $4::timestamptz - $7::interval)`,
|
||||
and at > $4::timestamptz - $7::interval)
|
||||
on conflict (machine, module, item, at) do nothing`,
|
||||
machine, d.Module, d.Item, *m.MeasuredAt, *m.Size, m.LastWrite,
|
||||
fmt.Sprintf("%d seconds", int(readingEvery.Seconds()))); err != nil {
|
||||
return change, err
|
||||
|
||||
Reference in New Issue
Block a user