summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-09-02 12:15:38 +0200
committerJürg Billeter <j@bitron.ch>2019-09-03 11:17:28 +0200
commitd13336addeb1c5726a3b84c1536dc29781b87df4 (patch)
treec22ab45ce33ad5dceaca517f662b4495d4a73a27
parentdf3000b05fd1b8f65289b3b0fbf476a19ef61869 (diff)
downloadbuildstream-d13336addeb1c5726a3b84c1536dc29781b87df4.tar.gz
_basecache.py: Add has_open_grpc_channels() method
-rw-r--r--src/buildstream/_basecache.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/buildstream/_basecache.py b/src/buildstream/_basecache.py
index 431a7304e..9ad6c1277 100644
--- a/src/buildstream/_basecache.py
+++ b/src/buildstream/_basecache.py
@@ -59,6 +59,18 @@ class BaseCache():
self._has_fetch_remotes = False
self._has_push_remotes = False
+ # has_open_grpc_channels():
+ #
+ # Return whether there are gRPC channel instances. This is used to safeguard
+ # against fork() with open gRPC channels.
+ #
+ def has_open_grpc_channels(self):
+ for project_remotes in self._remotes.values():
+ for remote in project_remotes:
+ if remote.channel:
+ return True
+ return False
+
# release_resources():
#
# Release resources used by BaseCache.