mirror of
https://github.com/oarkflow/mq.git
synced 2025-09-26 20:11:16 +08:00
update
This commit is contained in:
@@ -2,7 +2,6 @@ package bpool
|
||||
|
||||
import (
|
||||
"io"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// ByteBuffer provides byte buffer, which can be used for minimizing
|
||||
@@ -105,7 +104,7 @@ func (b *ByteBuffer) SetString(s string) {
|
||||
|
||||
// String returns string representation of ByteBuffer.B.
|
||||
func (b *ByteBuffer) String() string {
|
||||
return *(*string)(unsafe.Pointer(&b.B))
|
||||
return string(b.B)
|
||||
}
|
||||
|
||||
// Reset makes ByteBuffer.B empty.
|
||||
|
4
pool.go
4
pool.go
@@ -394,6 +394,10 @@ func (wp *Pool) Start(numWorkers int) {
|
||||
heap.Push(&wp.taskQueue, task)
|
||||
}
|
||||
wp.taskQueueLock.Unlock()
|
||||
// Signal workers that tasks are available after restoring from storage
|
||||
wp.taskAvailableCond.L.Lock()
|
||||
wp.taskAvailableCond.Broadcast()
|
||||
wp.taskAvailableCond.L.Unlock()
|
||||
}
|
||||
for i := 0; i < numWorkers; i++ {
|
||||
wp.wg.Add(1)
|
||||
|
@@ -9,6 +9,12 @@ import (
|
||||
|
||||
func RecoverPanic(labelGenerator func() string) {
|
||||
if r := recover(); r != nil {
|
||||
defer func() {
|
||||
if rr := recover(); rr != nil {
|
||||
// If logging or labelGenerator panics, just print a minimal message
|
||||
fmt.Printf("[PANIC] - error during panic recovery: %v\n", rr)
|
||||
}
|
||||
}()
|
||||
pc, file, line, ok := runtime.Caller(2)
|
||||
funcName := "unknown"
|
||||
if ok {
|
||||
|
Reference in New Issue
Block a user