1
0
Fork 0

- forced using the cache in 'stream-iri' if a stream for the same URL already exists.

This commit is contained in:
cage 2024-04-20 12:25:39 +02:00
parent 46ba8f2d07
commit 14aa2af9aa
1 changed files with 113 additions and 99 deletions

View File

@ -75,6 +75,13 @@
(defun find-streaming-stream-url ()
(find-db-stream-if (lambda (a) (eq (status a) +stream-status-streaming+))))
(defun url-streaming-p (url)
(find-db-stream-if (lambda (a)
(and (string= (server-stream-handle a)
url)
(eq (status a)
+stream-status-streaming+)))))
(defgeneric stop-stream-thread (object))
(defmethod stop-stream-thread ((object gemini-stream))
@ -1147,11 +1154,18 @@ local file paths."
(status +stream-status-streaming+)
(process-iri-lines-function (collect-iri-lines-clsr main-window
iri)))
(flet ((actually-use-cache-p ()
;; we need to use 't' or 'nil' as results from this
;; function because the json-rpc does not know how to
;; encode generalized booleans to JSON
(if (url-streaming-p iri)
t
use-cache)))
(let ((connecting-response (cev:enqueue-request-and-wait-results :gemini-request
1
ev:+maximum-event-priority+
iri
use-cache
(actually-use-cache-p)
nil)))
(multiple-value-bind (status-code
status-description
@ -1241,7 +1255,7 @@ local file paths."
:status status)))
(push-db-stream background-stream))))
(t
(error "Unrecognized stream status for address ~s: ~s" iri status))))))))
(error "Unrecognized stream status for address ~s: ~s" iri status)))))))))
(defun open-iri-clsr (main-window use-cache)
(lambda ()