Skip to content

Commit 2d05fa1

Browse files
committed
fix: do not block identify on SSE client shutdown completion
1 parent 8e1af76 commit 2d05fa1

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

libs/client-sdk/src/client_impl.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,11 @@ std::future<bool> ClientImpl::IdentifyAsync(Context context) {
149149
}
150150

151151
void ClientImpl::RestartDataSource() {
152-
auto start_op = [this]() {
153-
data_source_ = data_source_factory_();
154-
data_source_->Start();
155-
};
156-
if (!data_source_) {
157-
return start_op();
152+
if (data_source_) {
153+
data_source_->ShutdownAsync(nullptr);
158154
}
159-
data_source_->ShutdownAsync(start_op);
155+
data_source_ = data_source_factory_();
156+
data_source_->Start();
160157
}
161158

162159
std::future<bool> ClientImpl::StartAsyncInternal(
@@ -170,7 +167,7 @@ std::future<bool> ClientImpl::StartAsyncInternal(
170167
if (auto const state = status.State(); IsInitialized(state)) {
171168
init_promise->set_value(result(status.State()));
172169
return true; /* delete this change listener since the desired
173-
state was reached */
170+
state was reached */
174171
}
175172
return false; /* keep the change listener */
176173
});

0 commit comments

Comments
 (0)