From 471129b1e3510bedc1a4a71fe5656961e803ca66 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Mon, 2 May 2011 20:15:39 +0200 Subject: [PATCH] Autoload `url-queue-retrieve', and fix up the pruning code. --- lisp/url/ChangeLog | 3 +++ lisp/url/url-queue.el | 15 ++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 55b400e2bd7..1049d09d6db 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -3,6 +3,9 @@ * url-queue.el: New file. (url-queue-run-queue): Pick the first waiting job, and not the last. + (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 diff --git a/lisp/url/url-queue.el b/lisp/url/url-queue.el index d572418e3e2..7f20f80cc99 100644 --- a/lisp/url/url-queue.el +++ b/lisp/url/url-queue.el @@ -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) +;;;###autoload (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) (ignore-errors (url-retrieve (url-queue-url job) #'url-queue-callback-function (list job) @@ -98,12 +99,12 @@ controls the level of parallelism via the url-queue-timeout)) (push job dead-jobs))) (dolist (job dead-jobs) - (when (processp (url-queue-process job)) + (when (bufferp (url-queue-buffer job)) (ignore-errors - (delete-process (url-queue-process job))) + (delete-process (get-buffer-process (url-queue-buffer job)))) (ignore-errors - (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)