Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove AsNoTracking from EngineAssetRepository GetAsset #758

Closed
JackLewis-digirati opened this issue Mar 11, 2024 · 1 comment · Fixed by #761
Closed

remove AsNoTracking from EngineAssetRepository GetAsset #758

JackLewis-digirati opened this issue Mar 11, 2024 · 1 comment · Fixed by #761
Assignees
Labels
bug Something isn't working engine jira marks issue for crossposting to JIRA

Comments

@JackLewis-digirati
Copy link
Contributor

As part of the work on DeliveryChannels AsNoTracking was added to GetAsset, this is incorrect as by adding AsNoTracking you're fighting against what EF gives you. IIRC we always will update the asset so we definitely do want to track it.

A better solution would be to remove AsNoTracking and also remove code that doesn't update the asset if it's already being tracked, i.e.: https://github.com/dlcs/protagonist/blob/develop/src/protagonist/Engine/Data/EngineAssetRepository.cs#L167-L176

@JackLewis-digirati JackLewis-digirati added bug Something isn't working engine jira marks issue for crossposting to JIRA labels Mar 11, 2024
@donaldgray
Copy link
Member

Some further context:

The code in https://github.com/dlcs/protagonist/blob/develop/src/protagonist/Engine/Data/EngineAssetRepository.cs#L167-L176 is to handle the fact that the Asset may (when handling Timebased completion, in response to ElasticTranscoder raising completed notification) or may not (when API calls engine directly or via queue) have been loaded from dbContext. Therefor when saving we need to know whether it's tracked, or needs to be attached.

However, #622 changes this behaviour so that the Asset is always loaded from the dbContext regardless of the entrypoint to the engine. Using .AsNoTracking() mimicks the current behaviour (sometimes tracked, sometimes not) but this also means we need to keep the unnecessary complexity of working out whether it's tracked or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working engine jira marks issue for crossposting to JIRA
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants