You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2021/07/15 09:32:20 UTC

[skywalking-client-js] branch master updated: fixes apache/skywalking#7303 (#66)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-client-js.git


The following commit(s) were added to refs/heads/master by this push:
     new f0f5733  fixes apache/skywalking#7303 (#66)
f0f5733 is described below

commit f0f5733f043a2d38a8a30e12af6504f370f5306a
Author: Huang <h...@xnozo.com>
AuthorDate: Thu Jul 15 17:32:12 2021 +0800

    fixes apache/skywalking#7303 (#66)
---
 CHANGES.md           | 1 +
 src/trace/segment.ts | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 867da4a..f681dd7 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -3,6 +3,7 @@
 ## 0.7.0
 
 1. Support setting time interval to report segments.
+2. Fix segments report only send once
 
 ## 0.6.0
 
diff --git a/src/trace/segment.ts b/src/trace/segment.ts
index 2bbf1bf..19aaaa7 100644
--- a/src/trace/segment.ts
+++ b/src/trace/segment.ts
@@ -22,7 +22,7 @@ import { SegmentFields } from './type';
 import { CustomOptionsType } from '../types';
 
 export default function traceSegment(options: CustomOptionsType) {
-  let segments = [] as SegmentFields[];
+  const segments = [] as SegmentFields[];
   // inject interceptor
   xhrInterceptor(options, segments);
   windowFetch(options, segments);
@@ -39,6 +39,6 @@ export default function traceSegment(options: CustomOptionsType) {
       return;
     }
     new Report('SEGMENTS', options.collector).sendByXhr(segments);
-    segments = [];
+    segments.splice(0, segments.length);
   }, options.traceTimeInterval);
 }