D3: sync słownika dyscyplin przez sync_dictionary (+ fix transakcji)#612
Open
mpasternak wants to merge 1 commit into
Open
D3: sync słownika dyscyplin przez sync_dictionary (+ fix transakcji)#612mpasternak wants to merge 1 commit into
mpasternak wants to merge 1 commit into
Conversation
download_disciplines/sync_disciplines przestają trzymać otwartą transakcję przez czas remote-calla do PBN. Pobranie idzie teraz przez sync_dictionary(fetch, upsert) (wzorzec materialize-before-atomic z django-pbn-client 0.2.1): fetch poza transakcją, upsert atomowo. Matching do modeli BPP (Dyscyplina_Naukowa/TlumaczDyscyplin) wydzielony do osobnej @transaction.atomic metody — zostaje w BPP (BPP-specific). Usunięto martwy `if discipline.name == "weterynaria": pass`. Test-strażnik (transaction=True) dowodzi, że fetch dzieje się poza transakcją. Zależność django-pbn-client 0.2.1 pinowana git-source (do usunięcia po publikacji na PyPI). Stack: na feat/pbn-p4-reader. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Cel
download_disciplines/sync_disciplines(pbn_api/client/disciplines.py)przestają trzymać otwartą transakcję bazodanową przez czas remote-calla do PBN.
Fix bugu: wcześniej
@transaction.atomicobejmował cały remote-fetch —dłuższa niedostępność/wolność PBN blokowała połączenie DB. Teraz pobranie idzie
przez
django_pbn_client.sync_dictionary(fetch, upsert)(wzorzecmaterialize-before-atomic, django-pbn-client#3): fetch poza transakcją, upsert
atomowo.
Podział
sync_dictionaryw pakiecie.Dyscyplina_Naukowa/TlumaczDyscyplin) →wydzielone do
_sync_discipline_translations(@transaction.atomic),zostaje w BPP.
if discipline.name == "weterynaria": pass.Testy
test_client_disciplines.py: istniejącetest_download_disciplines/test_sync_disciplinesprzechodzą + nowy strażniktransaction=Truedowodzący, że
get_disciplines(remote) dzieje się POZA transakcją, a upsertWEWNĄTRZ. 11 passed.
Zależność / merge order
[tool.uv.sources]pinujedjango-pbn-clientgit-source do gałęzifeat/sync-dictionary. Po wydaniu django-pbn-client 0.2.1 na PyPI usunąćwpis (pin
>=0.2,<0.3wystarczy). Merge po django-pbn-client#3.Stack: na
feat/pbn-p4-reader(#611).🤖 Generated with Claude Code