          ('file-error
           (message! (bold (red "  FILE ERROR: %s" ex2)))
           (message! "  Trying again...")
-          (doom-refresh-packages)
+          (doom-refresh-packages t)
           ,@body))
      ('user-error
       (message! (bold (red "  ERROR: %s" ex))))

(defun doom/packages-update ()
  "Interactive command for updating packages."
  (interactive)
  (doom-refresh-packages)
  (let ((packages (sort (doom-get-outdated-packages) #'doom--sort-alpha)))
    (cond ((not packages)
           (message! (green "Everything is up-to-date")))

(defun doom-refresh-packages (&optional force-p)
  "Refresh ELPA packages."
  (doom-initialize)
  (when force-p
    (doom-refresh-clear-cache))
  (unless (persistent-soft-fetch 'last-pkg-refresh "emacs")
    (condition-case ex
        (progn
          (message "Refreshing package archives")
          (package-refresh-contents (not doom-debug-mode))
          (let ((i 0))
            (while package--downloads-in-progress
              (sleep-for 0 250))
            (persistent-soft-store 'last-pkg-refresh t "emacs" 900)))
    (error
     (doom-refresh-clear-cache)
     (message "Failed to refresh packages: %s" (cadr ex))))))

;;;###autoload
(defun doom-refresh-clear-cache ()
