From 5c040239312685013105d509eca437cb709789fd Mon Sep 17 00:00:00 2001 From: Wesley Kerfoot Date: Wed, 29 Aug 2012 17:57:55 -0400 Subject: [PATCH] fixed race condition that would result in a document update conflict if a user url was requested multiple times before the request was allowed to complete --- cacher.rkt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cacher.rkt b/cacher.rkt index 095b4ac..84b47aa 100644 --- a/cacher.rkt +++ b/cacher.rkt @@ -52,8 +52,9 @@ (hash-set! message '_id username) (hash-set! message (string->symbol page-num) data) (hash-set! message 'last_updated (current-inexact-milliseconds)) - (couchdb-put conn message) - data)) + (with-handlers ([exn:couchdb:conflict? (λ(x) data)]) + (couchdb-put conn message) + data))) ;; Checks if a document needs updating ;; Info -> String