Permalink
Browse files

Silence xolox#misc#async#periodic_callback() when request queue is empty

  • Loading branch information...
xolox committed Jun 30, 2014
1 parent 9d1f006 commit 0a707694807b6a6374f5d5fc3fd0e5bbd904dbe1
Showing with 20 additions and 18 deletions.
  1. +1 −1 README.md
  2. +18 −16 autoload/xolox/misc/async.vim
  3. +1 −1 doc/misc.txt
View
@@ -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
@@ -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
View
@@ -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*

0 comments on commit 0a70769

Please sign in to comment.