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,7 +86,10 @@
(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))
(doc-db-file->connection (car p))))])
(and
db
((let/ec esc ((let/ec esc
;; The db query: ;; The db query:
(define result (define result
@ -99,7 +102,7 @@
;; cache the connection, if none is already cached: ;; cache the connection, if none is already cached:
(or (box-cas! (cdr p) #f db) (or (box-cas! (cdr p) #f db)
(doc-db-disconnect db)) (doc-db-disconnect db))
(lambda () result)))))) (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))]