Repository navigation
Conversation
Enforcer
reviewed
Sep 9, 2024
| from sqlalchemy import MetaData, StaticPool, create_engine | ||
| from sqlalchemy.orm import Session, as_declarative | ||
|
|
||
| with NamedTemporaryFile() as f: |
There was a problem hiding this comment.
err does it work? NamedTemporaryFile by default deletes the file either when one exits context manager or file is closed
There was a problem hiding this comment.
AFAIU, it'll reuse the file name but right after this context manager file will be removed.
Since SQLAlchemy's engine is lazy, I wouldn't be surprised if it would touch the file on first use
| Base.metadata.create_all(bind=engine) | ||
|
|
||
|
|
||
| def session() -> Generator[Session, None, None]: |
| def quantity_repository( | ||
| backend: Backend = Depends(backend), | ||
| ) -> Generator[QuantityRepository, None, None]: | ||
| yield QuantityRepository(backend.event_store) |
| ) | ||
|
|
||
|
|
||
| @router.post("/process", name="outbox:process", status_code=200) |
| units: int = Body(...), | ||
| backend: Backend = Depends(backend), | ||
| ) -> None: | ||
| backend.event_store.append( |
There was a problem hiding this comment.
How about injecting just event_store ?
| metadata: MetaData | ||
|
|
||
|
|
||
| configure_models(Base) |
There was a problem hiding this comment.
Comments explaining the setup might be useful
|
|
||
|
|
||
| class QuantityRepository(Repository[Quantity]): | ||
| def publish(self, record: Recorded) -> None: |
There was a problem hiding this comment.
I'm a bit lost. How does record get into this method after outbox processing? I can't find any subscription
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.
No description provided.