Closed klowdo closed 2 years ago
pass context with transaction to eventHandlerInTX
eventHandlerInTX
passes the txCtx with transaction to handler instead of empty context
In handler that is assigned WithEventHandlerInTX write this below and you should get no session without this fix
WithEventHandlerInTX
func (c *myHandler) HandleEvent(ctx context.Context, e eh.Event) error{ session := mongodb.SessionFromContext(ctx) if session == nil { fmt.Println("no session") } else { fmt.Printf("session: %v", session.ID()) } }
Coverage increased (+0.07%) to 68.813% when pulling 441b029a01cd8621fa47091adf780749e4f99432 on klowdo:main into d9133a08eca7f4009fb9f22907bb3199dafdca2d on looplab:main.
Description
pass context with transaction to
eventHandlerInTX
Affected Components
Related Issues
Solution and Design
passes the txCtx with transaction to handler instead of empty context
Steps to test and verify
In handler that is assigned
WithEventHandlerInTX
write this below and you should get no session without this fix