Scope mapping writes and stabilize sibling lookup
The tracker-mapping worker loaded a pattern in its claim transaction and committed the resolution in a separate, later transaction. A full-row Update would write back stale values and clobber any user edit made in between. Add UpdateMapping, which writes only the worker-resolved columns (common_tracker_pattern_id, third_party_id, and a description filled only when still empty), leaving user-editable fields untouched. Also add ORDER BY tracker_pattern_id to the sibling pattern lookup: the query used LIMIT without an ORDER BY, so an over-limit match set returned an arbitrary subset and could resolve the third party differently across runs. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -267,7 +267,7 @@ func (h *trackerMappingHandler) Process(ctx context.Context, tp coredata.Tracker
|
||||
}
|
||||
}
|
||||
|
||||
if err := tp.Update(ctx, tx, scope); err != nil {
|
||||
if err := tp.UpdateMapping(ctx, tx, scope); err != nil {
|
||||
return fmt.Errorf("cannot update tracker pattern mapping: %w", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user