You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To ensure true uniqueness of searchee_id/guid in decision, the following should be added to the table:
table.unique(['searchee_id', 'guid'])
This change can't be made without doing some cleanup ahead of time though, as there are likely "duplicate" entries in the existing decision table. So a migration script, which probably should remove all decisions but the last ones in case of duplicates, will be necessary.
A more elegant way of handling it would be for assessCandidateCaching (exported as assessCandidate) to "attempt to create a decision" ahead of time (with dummy values), and make the necessary updates when needed. This would be akin to https://github.com/cross-seed/cross-seed/blob/master/src/pipeline.ts#L75-L79 which attempts to create a searchee ahead of time to ensure a unique Id is available for follow up operations.
The current logic behind the decision caching system assumes that there should be only one entry per
searchee_id
/guid
pair in the decision table https://github.com/cross-seed/cross-seed/blob/master/src/decide.ts#L215-L224The database setup though does not accomodate for that: https://github.com/cross-seed/cross-seed/blob/master/src/migrations/00-initialSchema.ts#L12
To ensure true uniqueness of
searchee_id
/guid
indecision
, the following should be added to the table:This change can't be made without doing some cleanup ahead of time though, as there are likely "duplicate" entries in the existing
decision
table. So a migration script, which probably should remove all decisions but the last ones in case of duplicates, will be necessary.In addition to the table constraints themselves, the logic of
decision
creation relies on calls toassessAndSaveResults
(not exported) https://github.com/cross-seed/cross-seed/blob/master/src/decide.ts#L185-L203 which may happen multiple times.A more elegant way of handling it would be for
assessCandidateCaching
(exported asassessCandidate
) to "attempt to create a decision" ahead of time (with dummy values), and make the necessary updates when needed. This would be akin to https://github.com/cross-seed/cross-seed/blob/master/src/pipeline.ts#L75-L79 which attempts to create asearchee
ahead of time to ensure a unique Id is available for follow up operations.Discussion on discord: https://discord.com/channels/880949701845872672/880949702349164556/1162863467129225257
The text was updated successfully, but these errors were encountered: