Unverified Commit 0093973a authored by Hong Minhee's avatar Hong Minhee
Browse files

Use immutable array operation in #storeWithCas

Avoid mutating the existing array from KvStore by using spread syntax
to create a new array instead of push().

https://github.com/fedify-dev/fedify/pull/502#discussion_r2643077165
parent 4bcfdf27
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -507,11 +507,7 @@ export class FedifySpanExporter implements SpanExporter {

    await this.#setWithCasRetry<TraceActivityRecord[]>(
      key,
      (existing) => {
        const records = existing ?? [];
        records.push(record);
        return records;
      },
      (existing) => (existing ? [...existing, record] : [record]),
      options,
    );
    await this.#updateTraceSummary(record, options);