diff options
Diffstat (limited to 'l')
| -rw-r--r-- | l/extreload.asd | 1 | ||||
| -rw-r--r-- | l/src/main.lisp | 23 | 
2 files changed, 14 insertions, 10 deletions
| diff --git a/l/extreload.asd b/l/extreload.asd index b283481..2748eee 100644 --- a/l/extreload.asd +++ b/l/extreload.asd @@ -2,6 +2,7 @@    :version "0.0.1"    :depends-on (:jsown                  :sysexits +                :trivial-timeout                  :unix-opts                  :wait-group                  :websocket-driver-client) diff --git a/l/src/main.lisp b/l/src/main.lisp index 641255b..0695f20 100644 --- a/l/src/main.lisp +++ b/l/src/main.lisp @@ -6,6 +6,8 @@  (defvar *extension-targets-count* 0)  (defvar *last-session-id* "") +(defconstant +timeout-seconds+ 5) +  (opts:define-opts    (:name :socket-url           :description "DevTools protocol WebSocket URL" @@ -32,18 +34,19 @@        ;; Store the WebSocket client as a global.        (defvar *client* (ws-client config)) -      (with-websocket-connection (*client*) -        (wsd:on :message *client* -                #'(lambda (message) -                    (ws-on-message -                      message -                      (extension-ids config) -                      (reload-current-tab config)))) +      (trivial-timeout:with-timeout (+timeout-seconds+) +        (with-websocket-connection (*client*) +          (wsd:on :message *client* +                  #'(lambda (message) +                      (ws-on-message +                       message +                       (extension-ids config) +                       (reload-current-tab config)))) -        (websocket-send *client* (target-get-targets-msg -                                   (next-call-id *devtools-root-call-id*))) +          (websocket-send *client* (target-get-targets-msg +                                    (next-call-id *devtools-root-call-id*))) -        (wait-group:wait *wg*))))) +          (wait-group:wait *wg*))))))  (defun ws-on-message (message extension-ids reload-current-tab)    (let* ((response (jsown:parse message)) | 
