Attila Lendvai schreef op di 28-09-2021 om 18:24 [+0200]: > (define (call-with-store proc) > "Call PROC with an open store connection." > - (let ((store (open-connection))) > + (let ((store '())) > (define (thunk) > (parameterize ((current-store-protocol-version > (store-connection-version store))) > (call-with-values (lambda () (proc store)) > (lambda results > - (close-connection store) > (apply values results))))) > > - (with-exception-handler (lambda (exception) > - (close-connection store) > - (raise-exception exception)) > - thunk))) > + (dynamic-wind > + (lambda () > + (set! store (open-connection))) > + thunk > + (lambda () > + (close-connection store) > + (set! store '()))))) Do we really need to close and open the connection again every time a continuation is made and resumed? This seems inefficient if a threading mechanism implemented by continuations is used (such as guile-fibers), and there are two threads (‘fibers’) communicating and waiting with/for each other in a loop, causing many ‘context switches’ (i.e., many captured and resumed continuations). Also note that a connection has some state: to the guix-daemon, it acts as a GC root for everything built with the connection, and everything added to the store (with add-to-store & friends) with that connection ... Simply reconnecting isn't sufficient. Greetings, Maxime