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

fix: remove big transaction in handleEvents #26

Closed

Conversation

qiankunli
Copy link
Contributor

No description provided.

@qiankunli qiankunli force-pushed the fix/remove-big-transaction branch 2 times, most recently from 2ba15e0 to deff899 Compare March 27, 2024 08:26
@ealyn
Copy link
Collaborator

ealyn commented Mar 28, 2024

引入lock/db有点捆绑的意思了,我倾向于拆开成一个event一个transaction,也能改进并发

@qiankunli
Copy link
Contributor Author

引入lock/db有点捆绑的意思了,我倾向于拆开成一个event一个transaction,也能改进并发

引入lock db的意思主要是 保证多实例下只有一个实例 可以执行handleevent 逻辑。
之前的实现里,大事务里 select * from service where name = xx for update 变相的实现的全局锁。移除掉大事务后,就会导致多个实例的handleevents 同时执行,一个eventhandler 被执行多次。

@qiankunli qiankunli force-pushed the fix/remove-big-transaction branch 2 times, most recently from a057178 to 6ef9e2d Compare April 11, 2024 10:06
@@ -155,6 +156,7 @@ type EventBus struct {

cb dddfirework.DomainEventHandler
cleanCron *cron.Cron
lock *lockdb.DBLock
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个感觉强制绑定dblock了,一定需要引入个dblock么

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants