mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-22 20:30:07 +00:00
speed up worker chatter
This commit is contained in:
parent
4f7efdcc8b
commit
69fce3e1fc
1 changed files with 8 additions and 9 deletions
|
@ -5,7 +5,7 @@ function _p9k_worker_main() {
|
||||||
exec 0<$_p9k__worker_file_prefix.fifo || return
|
exec 0<$_p9k__worker_file_prefix.fifo || return
|
||||||
zf_rm $_p9k__worker_file_prefix.fifo || return
|
zf_rm $_p9k__worker_file_prefix.fifo || return
|
||||||
|
|
||||||
local -i reset n
|
local -i reset
|
||||||
local req fd
|
local req fd
|
||||||
local -a ready
|
local -a ready
|
||||||
local _p9k_worker_request_id
|
local _p9k_worker_request_id
|
||||||
|
@ -34,9 +34,9 @@ function _p9k_worker_main() {
|
||||||
if [[ $fd == 0 ]]; then
|
if [[ $fd == 0 ]]; then
|
||||||
local buf=
|
local buf=
|
||||||
[[ -t 0 ]] # https://www.zsh.org/mla/workers/2020/msg00207.html
|
[[ -t 0 ]] # https://www.zsh.org/mla/workers/2020/msg00207.html
|
||||||
if sysread -c n -t 0 'buf[$#buf+1]'; then
|
if sysread -t 0 'buf[$#buf+1]'; then
|
||||||
while [[ $buf != *$'\x1e' ]] || (( n == 8192 )); do
|
while [[ $buf != *$'\x1e' ]]; do
|
||||||
sysread -c n 'buf[$#buf+1]' || return
|
sysread 'buf[$#buf+1]' || return
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
(( $? == 4 )) || return
|
(( $? == 4 )) || return
|
||||||
|
@ -116,12 +116,11 @@ function _p9k_worker_receive() {
|
||||||
(( $# <= 1 )) || return
|
(( $# <= 1 )) || return
|
||||||
|
|
||||||
local buf resp
|
local buf resp
|
||||||
local -i n
|
|
||||||
|
|
||||||
[[ -t $_p9k__worker_resp_fd ]] # https://www.zsh.org/mla/workers/2020/msg00207.html
|
[[ -t $_p9k__worker_resp_fd ]] # https://www.zsh.org/mla/workers/2020/msg00207.html
|
||||||
if sysread -i $_p9k__worker_resp_fd -c n -t 0 'buf[$#buf+1]'; then
|
if sysread -i $_p9k__worker_resp_fd -t 0 'buf[$#buf+1]'; then
|
||||||
while [[ ${buf%%$'\x05'#} != (|*$'\x1e') ]] || (( n == 8192 )); do
|
while [[ $buf == *[^$'\x05\x1e']$'\x05'# ]]; do
|
||||||
sysread -i $_p9k__worker_resp_fd -c n 'buf[$#buf+1]' || return
|
sysread -i $_p9k__worker_resp_fd 'buf[$#buf+1]' || return
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
(( $? == 4 )) || return
|
(( $? == 4 )) || return
|
||||||
|
@ -177,7 +176,7 @@ function _p9k_worker_start() {
|
||||||
setopt monitor || return
|
setopt monitor || return
|
||||||
{
|
{
|
||||||
[[ -n $_p9k__worker_resp_fd ]] && return
|
[[ -n $_p9k__worker_resp_fd ]] && return
|
||||||
_p9k__worker_file_prefix=${TMPDIR:-/tmp}/p10k.worker.$EUID.$$.$EPOCHSECONDS
|
_p9k__worker_file_prefix=${TMPDIR:-/tmp}/p10k.worker.$EUID.$sysparams[pid].$EPOCHSECONDS
|
||||||
|
|
||||||
sysopen -r -o cloexec -u _p9k__worker_resp_fd <(
|
sysopen -r -o cloexec -u _p9k__worker_resp_fd <(
|
||||||
if [[ -n $_POWERLEVEL9K_WORKER_LOG_LEVEL ]]; then
|
if [[ -n $_POWERLEVEL9K_WORKER_LOG_LEVEL ]]; then
|
||||||
|
|
Loading…
Reference in a new issue