Skip to content

Commit

Permalink
Silence xolox#misc#async#periodic_callback() when request queue is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Jun 30, 2014
1 parent 9d1f006 commit 0a70769
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -38,7 +38,7 @@ from the source code of the miscellaneous scripts using the Python module
<!-- Start of generated documentation -->

The documentation of the 92 functions below was extracted from
19 Vim scripts on June 30, 2014 at 00:41.
19 Vim scripts on June 30, 2014 at 02:45.

### Asynchronous Vim script evaluation

Expand Down
34 changes: 18 additions & 16 deletions autoload/xolox/misc/async.vim
Expand Up @@ -229,22 +229,24 @@ function! xolox#misc#async#periodic_callback() " {{{1
" process the response.
"
" [CursorHold]: http://vimdoc.sourceforge.net/htmldoc/autocmd.html#CursorHold
let num_processed = 0
call xolox#misc#msg#debug("vim-misc %s: Checking for asynchronous responses (%i responses not yet received) ..", g:xolox#misc#version, len(g:xolox#misc#async#requests))
for unique_number in sort(keys(g:xolox#misc#async#requests))
let request = g:xolox#misc#async#requests[unique_number]
let temporary_file = get(request, 'temporary_file', '')
if !empty(temporary_file) && getfsize(temporary_file) > 0
try
call xolox#misc#msg#debug("vim-misc %s: Found asynchronous response by %s in %s ..", g:xolox#misc#version, request['function'], temporary_file)
call xolox#misc#async#callback_to_parent(xolox#misc#persist#load(temporary_file))
let num_processed += 1
finally
call delete(temporary_file)
endtry
endif
endfor
call xolox#misc#msg#debug("vim-misc %s: Processed %i asynchronous responses (%i responses not yet received).", g:xolox#misc#version, num_processed, len(g:xolox#misc#async#requests))
if !empty(g:xolox#misc#async#requests)
let num_processed = 0
call xolox#misc#msg#debug("vim-misc %s: Checking for asynchronous responses (%i responses not yet received) ..", g:xolox#misc#version, len(g:xolox#misc#async#requests))
for unique_number in sort(keys(g:xolox#misc#async#requests))
let request = g:xolox#misc#async#requests[unique_number]
let temporary_file = get(request, 'temporary_file', '')
if !empty(temporary_file) && getfsize(temporary_file) > 0
try
call xolox#misc#msg#debug("vim-misc %s: Found asynchronous response by %s in %s ..", g:xolox#misc#version, request['function'], temporary_file)
call xolox#misc#async#callback_to_parent(xolox#misc#persist#load(temporary_file))
let num_processed += 1
finally
call delete(temporary_file)
endtry
endif
endfor
call xolox#misc#msg#debug("vim-misc %s: Processed %i asynchronous responses (%i responses not yet received).", g:xolox#misc#version, num_processed, len(g:xolox#misc#async#requests))
endif
endfunction

" }}}1
Expand Down
2 changes: 1 addition & 1 deletion doc/misc.txt
Expand Up @@ -167,7 +167,7 @@ from the source code of the miscellaneous scripts using the Python module
'vimdoctool.py' included in vim-tools [5].

The documentation of the 92 functions below was extracted from 19 Vim scripts
on June 30, 2014 at 00:41.
on June 30, 2014 at 02:45.

-------------------------------------------------------------------------------
*misc-asynchronous-vim-script-evaluation*
Expand Down

0 comments on commit 0a70769

Please sign in to comment.