Commit 471129b1 authored by Lars Magne Ingebrigtsen's avatar Lars Magne Ingebrigtsen
Browse files

Autoload `url-queue-retrieve', and fix up the pruning code.

parent 08da93f1
......@@ -3,6 +3,9 @@
* url-queue.el: New file.
(url-queue-run-queue): Pick the first waiting job, and not the
(url-queue-parallel-processes): Lower the concurrency level, since
Emacs doesn't seem to like too many async processes.
(url-queue-prune-old-entries): Fix up the pruning code.
2011-04-16 Lars Magne Ingebrigtsen <>
......@@ -31,7 +31,7 @@
(eval-when-compile (require 'cl))
(require 'browse-url)
(defcustom url-queue-parallel-processes 4
(defcustom url-queue-parallel-processes 2
"The number of concurrent processes."
:type 'integer
:group 'url)
......@@ -47,8 +47,9 @@
(defstruct url-queue
url callback cbargs silentp
process start-time)
buffer start-time)
(defun url-queue-retrieve (url callback &optional cbargs silent)
"Retrieve URL asynchronously and call CALLBACK with CBARGS when finished.
Like `url-retrieve' (which see for details of the arguments), but
......@@ -83,7 +84,7 @@ controls the level of parallelism via the
(apply (url-queue-callback job) (cons status (url-queue-cbargs job))))
(defun url-queue-start-retrieve (job)
(setf (url-queue-process job)
(setf (url-queue-buffer job)
(url-retrieve (url-queue-url job)
#'url-queue-callback-function (list job)
......@@ -98,12 +99,12 @@ controls the level of parallelism via the
(push job dead-jobs)))
(dolist (job dead-jobs)
(when (processp (url-queue-process job))
(when (bufferp (url-queue-buffer job))
(delete-process (url-queue-process job)))
(delete-process (get-buffer-process (url-queue-buffer job))))
(kill-buffer (process-buffer (url-queue-process job))))
(setq url-queue (delq job url-queue))))))
(kill-buffer (url-queue-buffer job))))
(setq url-queue (delq job url-queue)))))
(provide 'url-queue)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment