Compare commits

..

No commits in common. "main" and "v2.1.0" have entirely different histories.
main ... v2.1.0

View File

@ -21,7 +21,7 @@ type IContext interface {
Set(key string, data any) Set(key string, data any)
Get(key string) (any, bool) Get(key string) (any, bool)
RemoveMetaData(key string) RemoveMetaData(key string)
CleanupIn(lifetime time.Duration, onCleanup ...func()) CleanupIn(lifetime time.Duration)
Dispatch(event IEvent, filter func(c IContext) bool) Dispatch(event IEvent, filter func(c IContext) bool)
IsCaller(c IContext) bool IsCaller(c IContext) bool
} }
@ -88,7 +88,7 @@ func (context *context) RemoveMetaData(key string) {
delete(context.metadata, key) delete(context.metadata, key)
} }
func (context *context) CleanupIn(lifetime time.Duration, onCleanup ...func()) { func (context *context) CleanupIn(lifetime time.Duration) {
context.mutex.Lock() context.mutex.Lock()
defer context.mutex.Unlock() defer context.mutex.Unlock()
@ -104,9 +104,6 @@ func (context *context) CleanupIn(lifetime time.Duration, onCleanup ...func()) {
if context.timer != nil { if context.timer != nil {
di.Destroy[IContext](context.id) di.Destroy[IContext](context.id)
for _, cleaner := range onCleanup {
cleaner()
}
context.timer = nil context.timer = nil
} }
}(context.id) }(context.id)