[PATCH] D90587: [clangd] Control the delay between index hot reloading in remote-server-index
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 1 23:47:55 PST 2020
kbobyrev created this revision.
kbobyrev added a reviewer: kadircet.
Herald added subscribers: cfe-commits, usaxena95, arphaman.
Herald added a project: clang.
kbobyrev requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.
This helps reduce the time needed for remote-server-index shutdown.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D90587
Files:
clang-tools-extra/clangd/index/remote/server/Server.cpp
clang-tools-extra/clangd/test/remote-index/pipeline_helper.py
Index: clang-tools-extra/clangd/test/remote-index/pipeline_helper.py
===================================================================
--- clang-tools-extra/clangd/test/remote-index/pipeline_helper.py
+++ clang-tools-extra/clangd/test/remote-index/pipeline_helper.py
@@ -32,7 +32,7 @@
index_server_process = subprocess.Popen([
'clangd-index-server', '--server-address=' + server_address,
- args.index_file, args.project_root
+ '--hot-reload-frequency=3', args.index_file, args.project_root
],
stderr=subprocess.PIPE)
Index: clang-tools-extra/clangd/index/remote/server/Server.cpp
===================================================================
--- clang-tools-extra/clangd/index/remote/server/Server.cpp
+++ clang-tools-extra/clangd/index/remote/server/Server.cpp
@@ -72,6 +72,13 @@
"server-address", llvm::cl::init("0.0.0.0:50051"),
llvm::cl::desc("Address of the invoked server. Defaults to 0.0.0.0:50051"));
+llvm::cl::opt<unsigned> HotReloadFrequency{
+ "hot-reload-frequency",
+ llvm::cl::desc("Delay between index hot reload checks (in seconds)"),
+ llvm::cl::init(90),
+ llvm::cl::Hidden,
+};
+
class RemoteIndexServer final : public v1::SymbolIndex::Service {
public:
RemoteIndexServer(clangd::SymbolIndex &Index, llvm::StringRef IndexRoot)
@@ -328,9 +335,9 @@
return -1;
}
- std::thread HotReloadThread([&Index, &Status, &FS]() {
+ const auto RefreshFrequency = std::chrono::seconds(HotReloadFrequency);
+ std::thread HotReloadThread([&Index, &Status, &FS, &RefreshFrequency]() {
llvm::vfs::Status LastStatus = *Status;
- static constexpr auto RefreshFrequency = std::chrono::seconds(30);
while (!clang::clangd::shutdownRequested()) {
hotReload(*Index, llvm::StringRef(IndexPath), LastStatus, FS);
std::this_thread::sleep_for(RefreshFrequency);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90587.302216.patch
Type: text/x-patch
Size: 1899 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201102/adc0fdec/attachment.bin>
More information about the cfe-commits
mailing list