clearlinux / swupd-server

Software update server (deprecated)
Other
13 stars 17 forks source link

update control over parallelism #43

Closed pohly closed 7 years ago

pohly commented 7 years ago

The SWUPD_NUM_THREADS env variable is now understood by all three commands and overrides the default number of threads. Setting it to 1 is useful while debugging the code that runs inside threads (only one thread hits breakpoints there). If SWUPD_NUM_THREADS is invalid, a warning is printed and the variable gets ignored, i.e. the default parallelism is used.

The hard-coded parallelism of 12 threads when analysing the file system gets replaced with n, where n is the number of available CPUs. The default is the same as before elsewhere (n for packing, 3 * n for fullfiles).

This is includes the proposed change from https://github.com/clearlinux/swupd-server/pull/34#discussion_r84758929 (separate helper function). Because it was less code this way, the default number of threads (instead of 1, as suggested) is use in case of an invalid env var.

phmccarty commented 7 years ago

+1

tmarcu commented 7 years ago

Looks good here.