Documentation
¶
Overview ¶
Package uploadlock serializes App Store Connect asset uploads across asc processes on one machine.
Several asc processes uploading at once multiply their requests against one App Store Connect account, which answers with 429s, and share one network link, which pushes slow uploads past their deadline. The lock makes a second upload wait for the first instead.
Index ¶
Constants ¶
const EnvVar = "ASC_UPLOAD_LOCK"
EnvVar disables the lock when set to a false value such as 0.
Variables ¶
This section is empty.
Functions ¶
func Acquire ¶
Acquire takes the asc upload lock shared by every process of this OS user and returns the function that releases it. The operating system also releases the lock when the process exits, including after a crash.
While another asc process holds the lock, Acquire tells stderr once and waits up to 30 minutes. Callers should take the lock before they start any upload deadline, so the wait does not count against it. If the lock file cannot be opened, Acquire warns and returns without locking, so an unusable cache directory never blocks an upload. ASC_UPLOAD_LOCK=0 skips the lock.
func SetDirForTest ¶
func SetDirForTest(dir string) func()
SetDirForTest replaces the directory that holds the lock file. The returned function restores the previous value.
func SetWaitLimitForTest ¶
SetWaitLimitForTest replaces how long Acquire waits for another upload. The returned function restores the previous value.
Types ¶
This section is empty.