<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/3341/">https://reviewboard.asterisk.org/r/3341/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By Mark Michelson.</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/branches/12/res/res_sorcery_realtime.c <span style="color: grey">(410467)</span></li>
<li>/branches/12/main/config.c <span style="color: grey">(410467)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/3341/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>