[asterisk-dev] [Code Review] 3341: Realtime: Be more consistent with how returns of store and update operations are treated.
Joshua Colp
reviewboard at asterisk.org
Thu Mar 13 06:46:11 CDT 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3341/#review11160
-----------------------------------------------------------
Ship it!
Ship It!
- Joshua Colp
On March 12, 2014, 6:26 p.m., Mark Michelson wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3341/
> -----------------------------------------------------------
>
> (Updated March 12, 2014, 6:26 p.m.)
>
>
> Review request for Asterisk Developers.
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> When storing or updating realtime backends, the functions are supposed to return the number of records affected by the operation or < 0 if there was an error.
>
> I found that within the config API itself, the realtime backend store and update functions were being handled differently. The config API was treating any non-zero return as an error and treating a zero return as success.
>
> Further, I found that in res_sorcery_realtime, the return of ast_store_realtime_fields() had the same treatment: non-zero is an error and zero is success. This would result in registered sorcery observers not being notified if content was successfully stored in the realtime backend.
>
> I have made the following changes:
> * In the config API, the calls to realtime backend update and store functions treats >= 0 as success. This is because from its point of view, even if the realtime backend does not store or update records, it did not fail, and thus succeeded at the operation.
> * In res_sorcery_realtime, the call to ast_store_realtime_fields() treats > 0 as success. This is because from its point of view, it only cares if at least one record was updated so that sorcery observers can be notified of the changes.
>
>
> Diffs
> -----
>
> /branches/12/res/res_sorcery_realtime.c 410467
> /branches/12/main/config.c 410467
>
> Diff: https://reviewboard.asterisk.org/r/3341/diff/
>
>
> Testing
> -------
>
> Like with other realtime-related things I've been doing lately, this has been tested by doing some manual tests. In this case, with store and update, the easiest way to test was to use realtime as sorcery's backend when using external MWI.
>
> With these changes, the stores and updates are properly detected as successful and sorcery now notifies observers when content is created.
>
>
> Thanks,
>
> Mark Michelson
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140313/ead8254d/attachment.html>
More information about the asterisk-dev
mailing list