Skip to content

Commit 8c39708

Browse files
committed
bug fix
1 parent e09f12c commit 8c39708

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

Analytics-CSharp/Segment/Analytics/Analytics.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public Analytics(Configuration configuration)
4949
}
5050

5151
store = new Store(configuration.userSynchronizeDispatcher, configuration.exceptionHandler);
52-
storage = new Storage(store, configuration.writeKey, configuration.persistentDataPath, fileIODispatcher);
52+
storage = new Storage(store, configuration.writeKey, configuration.persistentDataPath, fileIODispatcher, configuration.exceptionHandler);
5353
timeline = new Timeline();
5454

5555
// Start everything

Analytics-CSharp/Segment/Analytics/Internal/ForTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ internal Analytics(Configuration configuration,
2727
)
2828
{
2929
this.configuration = configuration;
30-
this.analyticsScope = analyticsScope ?? new Scope();
30+
this.analyticsScope = analyticsScope ?? new Scope(configuration.exceptionHandler);
3131
IDispatcher dispatcher = new SynchronizeDispatcher();
3232
this.fileIODispatcher = fileIODispatcher ?? dispatcher;
3333
this.networkIODispatcher = networkIODispatcher ?? dispatcher;
3434
this.analyticsDispatcher = analyticsDispatcher ?? dispatcher;
35-
this.store = store ?? new Store(true);
36-
this.storage = storage ?? new Storage(this.store, configuration.writeKey, configuration.persistentDataPath, this.fileIODispatcher);
35+
this.store = store ?? new Store(true, configuration.exceptionHandler);
36+
this.storage = storage ?? new Storage(this.store, configuration.writeKey, configuration.persistentDataPath, this.fileIODispatcher, configuration.exceptionHandler);
3737
this.timeline = timeline ?? new Timeline();
3838

3939
Startup(httpClient);

Analytics-CSharp/Segment/Analytics/Utilities/Storage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ internal class Storage : ISubscriber
2525

2626
public const long MaxBatchSize = 475_000;
2727

28-
public Storage(Store store, string writeKey, string rootDir, IDispatcher ioDispatcher = default)
28+
public Storage(Store store, string writeKey, string rootDir, IDispatcher ioDispatcher = default, ICoroutineExceptionHandler exceptionHandler = default)
2929
{
3030
_store = store;
3131
_writeKey = writeKey;
3232
_userPrefs = new UserPrefs(rootDir + Path.DirectorySeparatorChar +
33-
"segment.prefs" + Path.DirectorySeparatorChar + writeKey);
33+
"segment.prefs" + Path.DirectorySeparatorChar + writeKey, exceptionHandler);
3434
_storageDirectory = rootDir + Path.DirectorySeparatorChar +
3535
"segment.data" + Path.DirectorySeparatorChar +
3636
writeKey + Path.DirectorySeparatorChar +

Analytics-CSharp/Segment/Analytics/Utilities/UserPrefs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class UserPrefs
3737

3838
private readonly IDispatcher _dispatcher;
3939

40-
public UserPrefs(string file)
40+
public UserPrefs(string file, ICoroutineExceptionHandler exceptionHandler = null)
4141
{
4242
cache = new Dictionary<string, object>();
4343
mutex = new object();
@@ -52,7 +52,7 @@ public UserPrefs(string file)
5252
// uses a new scope for UserPrefs, so interruption does not propagate to analytics scope
5353
// in addition, file I/O in this class are all blocking. need to have its own threads
5454
// to prevent blocking analytics threads
55-
_scope = new Scope();
55+
_scope = new Scope(exceptionHandler);
5656
_dispatcher = new Dispatcher(new LimitedConcurrencyLevelTaskScheduler(Environment.ProcessorCount));
5757
StartLoadFromDisk();
5858
}

Tests/StateTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public SystemTest()
3737
userSynchronizeDispatcher: true,
3838
defaultSettings: _settings
3939
);
40-
_storage = new Mock<Storage>(_store, "123", "tests", new SynchronizeDispatcher());
40+
_storage = new Mock<Storage>(_store, "123", "tests", new SynchronizeDispatcher(), null);
4141
}
4242

4343
[Fact]
@@ -137,7 +137,7 @@ public UserInfoTest()
137137
autoAddSegmentDestination: false,
138138
userSynchronizeDispatcher: true
139139
);
140-
_storage = new Mock<Storage>(_store, "123", "tests", new SynchronizeDispatcher());
140+
_storage = new Mock<Storage>(_store, "123", "tests", new SynchronizeDispatcher(), null);
141141
}
142142

143143
[Fact]

Tests/Utilities/EventPipelineTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public EventPipelineTest()
4545
.Setup(httpclient => httpclient.Upload(It.IsAny<string>()))
4646
.ReturnsAsync(true);
4747

48-
_storage = new Mock<Storage>(new Store(true), "123", "tests", new SynchronizeDispatcher());
48+
_storage = new Mock<Storage>(new Store(true), "123", "tests", new SynchronizeDispatcher(), null);
4949
_analytics = new Analytics(config,
5050
httpClient: _mockHttpClient.Object,
5151
storage: _storage.Object);

0 commit comments

Comments
 (0)