signal created_at fix (includes code)
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3333236. -->
Reported by: [rr404](https://www.drupal.org/user/3739954)
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>The Signal's created_at should be the datetime of the alert and not the datetime of the push<br><br>
CrowdSec SDK has been updated:<br>
* creation of Watcher function buildSignal //more flexible than createSignal<br>
* creation of Watcher function buildSimpleSignalForIp // for basic signals (see code bellow)<br>
* deprecation of createSignal helper function</p>
<h4 id="summary-steps-reproduce">Code evolutions in crowdsec/src/Buffer.php</h4>
<p>Because it's faster for this first interaction than to push the code (my account is allowed no fork yet):</p>
<pre>// in addSignal(...)<br>// ...<br> $now = (new \DateTime('now', new \DateTimeZone('UTC')))->format('Y-m-d\TH:i:s.u\Z');<br><br> $signals[] = [<br> 'scenario' => $scenario,<br> 'ip' => $ip,<br> 'duration' => $duration,<br> 'created_at' => $now,<br> ];<br>// ...</pre><pre>// in push()<br>// ...<br> try {<br> $pushSignals[] = buildSimpleSignalForIp(<br> $signal['ip'],<br> $signal['scenario'],<br> new DateTime($signal['created_at']),<br> '',<br> $signal['duration']<br> );<br> }<br> catch (ClientException $e) {<br>// ...</pre>
issue