feat: 新增数据库类型 mariadb, 分别为 mysql 和 mariadb 设置不同的数据库备份与恢复程序路径 (#81)

This commit is contained in:
kanzihuang
2024-01-05 17:23:29 +08:00
committed by GitHub
parent 85910bf440
commit 0be50f0995
16 changed files with 93 additions and 50 deletions

View File

@@ -57,13 +57,6 @@ func (s *DelayQueue[T]) TryDequeue() (T, bool) {
return s.zero, false
}
func (s *DelayQueue[T]) TryEnqueue(val T) bool {
s.mutex.Lock()
defer s.mutex.Unlock()
return s.enqueue(val)
}
func (s *DelayQueue[T]) Dequeue(ctx context.Context) (T, bool) {
// 出队锁:避免因重复获取队列头部同一元素降低性能
select {
@@ -162,6 +155,16 @@ func (s *DelayQueue[T]) enqueue(val T) bool {
return true
}
func (s *DelayQueue[T]) TryEnqueue(val T) bool {
s.mutex.Lock()
defer s.mutex.Unlock()
if s.priorityQueue.IsFull() {
return false
}
return s.enqueue(val)
}
func (s *DelayQueue[T]) Enqueue(ctx context.Context, val T) bool {
for {
// 全局锁:避免入队和出队信号的重置与激活出现并发问题