MCPcopy
hub / github.com/cloudreve/cloudreve / RemoteDownloadQueue

Method RemoteDownloadQueue

application/dependency/dependency.go:689–717  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

687}
688
689func (d *dependency) RemoteDownloadQueue(ctx context.Context) queue.Queue {
690 d.mu.Lock()
691 defer d.mu.Unlock()
692
693 _, reload := ctx.Value(ReloadCtx{}).(bool)
694 if d.remoteDownloadQueue != nil && !reload {
695 return d.remoteDownloadQueue
696 }
697
698 if d.remoteDownloadQueue != nil {
699 d.remoteDownloadQueue.Shutdown()
700 }
701
702 settings := d.SettingProvider()
703 queueSetting := settings.Queue(context.Background(), setting.QueueTypeRemoteDownload)
704
705 d.remoteDownloadQueue = queue.New(d.Logger(), d.TaskClient(), d.TaskRegistry(), d,
706 queue.WithBackoffFactor(queueSetting.BackoffFactor),
707 queue.WithMaxRetry(queueSetting.MaxRetry),
708 queue.WithBackoffMaxDuration(queueSetting.BackoffMaxDuration),
709 queue.WithRetryDelay(queueSetting.RetryDelay),
710 queue.WithWorkerCount(queueSetting.WorkerNum),
711 queue.WithName("RemoteDownloadQueue"),
712 queue.WithMaxTaskExecution(queueSetting.MaxExecution),
713 queue.WithResumeTaskType(queue.RemoteDownloadTaskType),
714 queue.WithTaskPullInterval(10*time.Second),
715 )
716 return d.remoteDownloadQueue
717}
718
719func (d *dependency) EntityRecycleQueue(ctx context.Context) queue.Queue {
720 d.mu.Lock()

Callers

nothing calls this directly

Calls 15

SettingProviderMethod · 0.95
LoggerMethod · 0.95
TaskClientMethod · 0.95
TaskRegistryMethod · 0.95
NewFunction · 0.92
WithBackoffFactorFunction · 0.92
WithMaxRetryFunction · 0.92
WithBackoffMaxDurationFunction · 0.92
WithRetryDelayFunction · 0.92
WithWorkerCountFunction · 0.92
WithNameFunction · 0.92
WithMaxTaskExecutionFunction · 0.92

Tested by

no test coverage detected