parallel

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package parallel 提供仅依赖 context 与 Go runtime 的有序批处理并发基础设施。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForEach

func ForEach(ctx context.Context, tasks int, work func(context.Context, int)) error

ForEach 在当前运行时可用并行度内处理每个索引。work 负责把各索引的业务失败写入 自己的结果槽,避免一个作品失败取消同一批的其他作品;context 取消仍立即停止派发。

func SystemWorkerCount

func SystemWorkerCount() int

SystemWorkerCount 采用当前 GOMAXPROCS;它会尊重容器 CPU quota、运行时环境和 调用��对 Go scheduler 的显式设置,不暴露 pixiv-cli 自己的并发配置或硬编码上限。

func WorkerCount

func WorkerCount(tasks int) int

WorkerCount 将系统可用并发收敛到本批任务数,既不创建空 worker,也不以固定数字 限制用户的下载任务。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL