Skip to content

Commit

Permalink
Fix signal being fired before object exists
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorNicollet committed Apr 11, 2013
1 parent bad42fe commit 329f047
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ohmCouchVersioned/ohmCouchVersioned.ml
Expand Up @@ -284,12 +284,15 @@ module Make = functor (Versioned:VERSIONED) -> struct
method diffs = diffs
end in

let! () = ohm begin
let! () = ohm $ Run.edit_context Versioned.couchDB (VersionTable.set vid version) in
Signals.version_create_call (vid,version)
end in
let! () = ohm (Run.edit_context Versioned.couchDB (VersionTable.set vid version)) in

let! result = ohm_req_or (return None) (refresh ~latest:(vid,version) id default) in

(* The refresh might create the object, so wait until after the refresh to call
any relevant signals. *)
let! () = ohm (Signals.version_create_call (vid,version)) in

refresh ~latest:(vid,version) id default
return (Some result)

let update ~id ~diffs ~info () =
do_update ~id ~default:None ~diffs ~info ()
Expand Down

0 comments on commit 329f047

Please sign in to comment.