Skip to content

Commit

Permalink
Add call+fallback for streamJournalChanged to watchman
Browse files Browse the repository at this point in the history
Summary:
# Context

SubscribeStreamTemporary is a function that allows users to recieve notifications whenever there is a change to the edenFS journal. Despite intended to be a temporary function, it's been named as such for about 6 years.

# This Diff
This diff replaces the call for watchman to subscribeStreamTemporary with a call for streamJournalChanged. It adds a fallback call for older versions without streamJournalChanged

Reviewed By: jdelliot

Differential Revision: D68240121

fbshipit-source-id: 0c3f9e98060bf80c1e0e78b06d8ac102a8a19060
  • Loading branch information
Chris Dinh authored and facebook-github-bot committed Jan 17, 2025
1 parent e792889 commit 207a429
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions watchman/watcher/eden.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1068,8 +1068,19 @@ class EdenView final : public QueryableView {
GetJournalPositionCallback& getJournalPositionCallback,
std::chrono::milliseconds settleTimeout) {
auto client = getEdenClient(thriftChannel_);
auto stream = client->sync_subscribeStreamTemporary(
std::string(root->root_path.data(), root->root_path.size()));
apache::thrift::ClientBufferedStream<::facebook::eden::JournalPosition>
stream;
try {
stream = client->sync_streamJournalChanged(
std::string(root->root_path.data(), root->root_path.size()));
} catch (const apache::thrift::TApplicationException& exc) {
log(DBG,
"running eden version does not have streamJournalChanged, falling back to subscribeStreamTemporary: ",
exc.what(),
"\n");
stream = client->sync_subscribeStreamTemporary(
std::string(root->root_path.data(), root->root_path.size()));
}
return std::move(stream).subscribeExTry(
&subscriberEventBase_,
[&settleCallback,
Expand Down

0 comments on commit 207a429

Please sign in to comment.