mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 01:08:31 +02:00
refactor: improve task management with xsync for concurrent access and enhance callback and subtasks handling as well as memory allocation
This commit is contained in:
@@ -45,7 +45,7 @@ var maxRetries = map[zerolog.Level]int{
|
||||
|
||||
func StartNotifDispatcher(parent task.Parent) *Dispatcher {
|
||||
dispatcher = &Dispatcher{
|
||||
task: parent.Subtask("notification"),
|
||||
task: parent.Subtask("notification", true),
|
||||
providers: F.NewSet[Provider](),
|
||||
logCh: make(chan *LogMessage),
|
||||
retryCh: make(chan *RetryMessage, 100),
|
||||
@@ -111,7 +111,7 @@ func (disp *Dispatcher) start() {
|
||||
}
|
||||
|
||||
func (disp *Dispatcher) dispatch(msg *LogMessage) {
|
||||
task := disp.task.Subtask("dispatcher")
|
||||
task := disp.task.Subtask("dispatcher", true)
|
||||
defer task.Finish("notif dispatched")
|
||||
|
||||
disp.providers.RangeAllParallel(func(p Provider) {
|
||||
@@ -126,7 +126,7 @@ func (disp *Dispatcher) dispatch(msg *LogMessage) {
|
||||
}
|
||||
|
||||
func (disp *Dispatcher) retry(messages []*RetryMessage) error {
|
||||
task := disp.task.Subtask("retry")
|
||||
task := disp.task.Subtask("retry", true)
|
||||
defer task.Finish("notif retried")
|
||||
|
||||
errs := gperr.NewBuilder("notification failure")
|
||||
|
||||
Reference in New Issue
Block a user