don't fail when there's no user-specific docindex

This commit is contained in:
Matthew Flatt 2012-11-24 05:27:16 -07:00
parent 777a6cd38b
commit 19d7519dfe

View File

@ -86,20 +86,23 @@
(or (and (box-cas! (cdr p) maybe-db #f) (or (and (box-cas! (cdr p) maybe-db #f)
maybe-db) maybe-db)
;; ... create a new one ;; ... create a new one
(doc-db-file->connection (car p)))]) (and (file-exists? (car p))
((let/ec esc (doc-db-file->connection (car p))))])
;; The db query: (and
(define result db
(doc-db-key->path db key ((let/ec esc
#:fail (lambda () ;; The db query:
;; Rollback within a connection can be slow, (define result
;; so abandon the connection and try again: (doc-db-key->path db key
(doc-db-disconnect db) #:fail (lambda ()
(esc (lambda () (try p)))))) ;; Rollback within a connection can be slow,
;; cache the connection, if none is already cached: ;; so abandon the connection and try again:
(or (box-cas! (cdr p) #f db) (doc-db-disconnect db)
(doc-db-disconnect db)) (esc (lambda () (try p))))))
(lambda () result)))))) ;; cache the connection, if none is already cached:
(or (box-cas! (cdr p) #f db)
(doc-db-disconnect db))
(lambda () result)))))))
(define dest (or (try main-db) (try user-db))) (define dest (or (try main-db) (try user-db)))
(and dest (and dest
((dest->source done-ht) dest))] ((dest->source done-ht) dest))]