]> git.ipfire.org Git - thirdparty/asterisk.git/commit
sorcery: Refactor create, update and delete to better deal with caches 12/2312/3
authorGeorge Joseph <george.joseph@fairview5.com>
Thu, 25 Feb 2016 21:13:19 +0000 (14:13 -0700)
committerGeorge Joseph <george.joseph@fairview5.com>
Mon, 29 Feb 2016 17:31:18 +0000 (11:31 -0600)
commit48d713a83232fc51fc95d2e50a72c67980e63354
tree8259a8eacd03391867d8a152b40d6a844b6ee54f
parentd35c494df1bfc1cc44d7483d9750f31d0184d020
sorcery:  Refactor create, update and delete to better deal with caches

The ast_sorcery_create, update and delete function have been refactored
to better deal with caches and errors.

The action is now called on all non-caching wizards first. If ANY succeed,
the action is called on all caching wizards and the observers are notified.
This way we don't put something in the cache (or update or delete) before
knowing the action was performed in at least 1 backend and we only call the
observers once even if there were multiple writable backends.

ast_sorcery_create was never adding to caches in the first place which
was preventing contacts from getting added to a memory_cache when they
were created.  In turn this was causing memory_cache to emit errors if
the contact was deleted before being retrieved (which would have
populated the cache).

ASTERISK-25811 #close
Reported-by: Ross Beer
Change-Id: Id5596ce691685a79886e57b0865888458d6e7b46
main/sorcery.c