question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting save errors with various class construtions

See original GitHub issue

I’m still trying to tackle an example app and making progress in some directions but still failing to understand the fundamentals in this library so please know that I’m super appreciative of your patience. Once I figure this out I hope to make the example library very clear and runnable.

I’m trying to understand how best to construct classes using either the WithReflexiveMutator or TimestampedVersionedEntity. I’ve created the same basic class user with the two modalities and getting different errors.

I’d love to understand the errors, yes. But I’d also like to get a decent representation of both so I’m 100% open to feedback, critique, even eye-rolling and muttered swears.

Here’s what I have so far: https://github.com/dgonzo/eventsourcing-kanban. See the README for the errors I’m seeing and the links to the relevant files.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
johnbywatercommented, Oct 17, 2017

One thought: about the UnitOfWork, I think it’s a nice way to go, to instantiate the application object for each request. But unfortunately at the moment, if there are many threads, and if each constructs its own application object, each application will receive all event from every application currently instantiated, because the pub-sub mechanism uses a module level dict, so they aren’t separated.

That means, unless we fix up the pub-sub mechanism, you will want to have only one application object per process.

There might be a better way to do it, such as scoping the subscriptions and the publication of events to be scoped either to a thread or a request (like SQLAlchemy). But at the moment, it’s perhaps best to just have one application object. So “unit of work” might not be the best name for the application… I suggest keeping the “unit of work” but have it use an application object that is constructed once in the process, after it starts but before any requests are handled (to avoid race conditions in setting up the application object).

FWIW I tried to write about this in the documentation, here: http://eventsourcing.readthedocs.io/en/v3.0.0/topics/user_guide/deployment.html#application-object

0reactions
dgonzocommented, Oct 17, 2017

@johnbywater thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dealing with errors and omissions - The Construction Specifier
An omission occurs when something required to complete the building or comply with the building codes is not shown on the plans and...
Read more >
Strange error in c++ class construction - Stack Overflow
The fix would be to define a default constructor, along with the one you have already defined. This way you can use both....
Read more >
Providing Multiple Constructors in Your Python Classes
In this step-by-step tutorial, you'll learn how to provide multiple constructors in your Python classes. To this end, you'll learn different ...
Read more >
Error Types - Visual Basic - Microsoft Learn
In this article. Syntax Errors; Run-Time Errors; Logic Errors; See also. In Visual Basic, errors fall into one of three categories: syntax ...
Read more >
The construction productivity imperative | McKinsey
Standardizing and modularizing components can save costs and time. Nevertheless, a significant number of companies do not apply this principle; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found