Repository navigation
Fix race condition in EF Core migration - #375
Merged
Merged
Conversation
…is was giving a race condition when generating the db
markettes
approved these changes
Jun 25, 2024
Jossec101
added a commit
that referenced
this pull request
Jun 25, 2024
…is was giving a race condition when generating the db (#375)
This was referenced Jun 25, 2024
RodriFS
added a commit
that referenced
this pull request
Jul 1, 2024
* feat: add address, isFrozen and tag * feat: filter frozen utxos * feat: utxo migration * feat: add postgres for nbxplorer * fix: add migration for optional address and tag * feat: RegisterUTXOs job * feat: add wallet to FMUTXO * feat(FMUTXO.cs): add IsSpent property to determine if UTXO is spent based on channel and withdrawal statuses * feat(FMUTXO.cs): add NBitcoin and NBXplorer dependencies for UTXO model enhancements feat(FMUTXO.cs): implement Equals method for UTXO comparison with NBitcoin types refactor(RegisterUTXOsJob.cs): adjust equality check to use modified Equals method in FMUTXO model for clarity and consistency * feat: consolidate migrations * fix: migration * refactor(ChannelOperationRequestRepositoryTests): add additional null parameter to constructor calls to align with updated constructor signature * Bump deps * Fix problem with new change in nbxplorer when tracking btc addresses * feat: rebuild of the migration * EF Core already does execute the migration in a transaction scope, this was giving a race condition when generating the db (#375) * feat: changes for deps update * Fix AddRangeAsync not using a generic function type making EF Core fail to recognize the entities when saving a list * Fix RegisterUTXOsJob to use WalletId instead of Wallet property * fix: rollback changes * feat(FMUTXO.cs): add Blazorise.Extensions for enhanced functionality refactor(FMUTXO.cs): improve IsSpent property logic to handle null collections feat(FUTXORepository.cs): include Tags in FMUTXOs query to provide more detailed data * fix: remove error and set the creation time and the update time * refactor(FUTXORepository.cs): optimize UTXO retrieval logic to enhance performance and accuracy feat(RegisterUTXOsJob.cs): log information after adding new UTXOs to enhance traceability fix(Constants.cs, launchSettings.json): align REGISTER_UTXOS_CRON schedule across configurations for consistency * fix: rollback the port * fix: remove isSpent * refactor(FUTXORepository): replace GetFromUTXOs with GetByOutpoint for specific UTXO retrieval feat(CoinSelectionService): update UTXO selection logic to handle new and existing UTXOs feat(CoinSelectionService): enhance error handling and logging for UTXO operations feat(Interfaces): update IFMUTXORepository interface to reflect method changes style(CoinSelectionService): add Blazorise dependencies for UI enhancements * fix(docker-compose.yml): change PostgreSQL service port mapping to avoid port conflicts * fix: fix method type * fix: remove unused imports * fix: comments * feat: UTXOTag in another file * fix: set to dbtrie again * feat: explanation of the job * Update src/Services/CoinSelectionService.cs Co-authored-by: Rodrigo <39995243+RodriFS@users.noreply.github.com> * Update src/Services/CoinSelectionService.cs Co-authored-by: Rodrigo <39995243+RodriFS@users.noreply.github.com> * feat(RegisterUTXOsJob.cs): skip processing wallets without derivation strategy refactor(RegisterUTXOsJob.cs): improve error logging format for consistency style(RegisterUTXOsJob.cs): change log level from Information to Debug for UTXO processing logs to reduce log verbosity * fix: tags in the relations * fix: add throw * chore: comments * refactor: remove job to add utxos * refactor: remove properties to rollback changes * refactor: remove unused methods * chore(FMUTXO.cs): remove unused using directives to clean up code * style(FUTXORepository.cs): remove extra whitespace for cleaner code format * refactor(Constants.cs): remove REGISTER_UTXOS_CRON constant and its environment variable handling as it is no longer used in the application * style(FMUTXO.cs): remove extra whitespace for cleaner code formatting * refactor(FMUTXO.cs): remove unused NBitcoin and NBXplorer imports to clean up code refactor(FMUTXO.cs): remove redundant Equals method that compares UTXO objects, simplifying the model * refactor: remove logic for FMUTXOs * refactor: remove spaces * refactor: rollback logic changes * style(CoinSelectionService.cs): add missing line break for better code readability * refactor: remove migration * feat: utxotag repository * refactor(UTXOTag.cs): remove FMUTXO navigation properties to decouple UTXOTag from FMUTXO model * feat(IUTXOTagRepository, UTXOTagRepository): add GetTagByKeyAndOutpoint method WHY: Enhance querying capabilities by allowing retrieval of UTXOTag based on both key and outpoint, facilitating more specific data access patterns. * style(UTXOTagRepository.cs): fix indentation for better code readability * refactor(UTXOTag): make Outpoint property non-nullable to enforce data integrity refactor(IUTXOTagRepository): rename GetTagByKeyAndOutpoint to GetByKeyAndOutpoint for consistency feat(IUTXOTagRepository): add GetByKeyValue method to query UTXOTags by key and value * feat: exclude frozen utxos * fix: add repository * feat: migration * refactor(NodeGuardServiceTests.cs): add missing null parameter to constructors for consistency refactor(BitcoinServiceTests.cs): add missing null parameter in CoinSelectionService constructor for completeness * feat: add unique constraint for key outpoint in the utxotag table * test: fix tests and add one more * Update src/Helpers/Constants.cs Co-authored-by: José A.P <53834183+Jossec101@users.noreply.github.com> --------- Co-authored-by: José A.P <53834183+Jossec101@users.noreply.github.com> Co-authored-by: Rodrigo <39995243+RodriFS@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes a race condition in the EF Core migration process. Previously, the migration already was a transaction but the RAW SQL code also did a nested transaction which was not needed and makes the migration process fail.