Browse Source

Merge "Use gearman client keepalive"

tags/3.6.0
Zuul 5 months ago
parent
commit
91e7e680a1

+ 1
- 1
requirements.txt View File

@@ -8,7 +8,7 @@ python-daemon>=2.0.4,<2.1.0
8 8
 extras
9 9
 statsd>=3.0
10 10
 voluptuous>=0.10.2
11
-gear>=0.9.0,<1.0.0
11
+gear>=0.13.0,<1.0.0
12 12
 apscheduler>=3.0
13 13
 PrettyTable>=0.6,<0.8
14 14
 babel>=1.0

+ 3
- 1
zuul/driver/github/githubconnection.py View File

@@ -152,7 +152,9 @@ class GithubGearmanWorker(object):
152 152
         ssl_ca = get_default(self.config, 'gearman', 'ssl_ca')
153 153
         self.gearman = gear.TextWorker('Zuul Github Connector')
154 154
         self.log.debug("Connect to gearman")
155
-        self.gearman.addServer(server, port, ssl_key, ssl_cert, ssl_ca)
155
+        self.gearman.addServer(server, port, ssl_key, ssl_cert, ssl_ca,
156
+                               keepalive=True, tcp_keepidle=60,
157
+                               tcp_keepintvl=30, tcp_keepcnt=5)
156 158
         self.log.debug("Waiting for server")
157 159
         self.gearman.waitForServer()
158 160
         self.log.debug("Registering")

+ 3
- 1
zuul/executor/client.py View File

@@ -122,7 +122,9 @@ class ExecutorClient(object):
122 122
         ssl_cert = get_default(self.config, 'gearman', 'ssl_cert')
123 123
         ssl_ca = get_default(self.config, 'gearman', 'ssl_ca')
124 124
         self.gearman = ZuulGearmanClient(self)
125
-        self.gearman.addServer(server, port, ssl_key, ssl_cert, ssl_ca)
125
+        self.gearman.addServer(server, port, ssl_key, ssl_cert, ssl_ca,
126
+                               keepalive=True, tcp_keepidle=60,
127
+                               tcp_keepintvl=30, tcp_keepcnt=5)
126 128
 
127 129
         self.cleanup_thread = GearmanCleanup(self)
128 130
         self.cleanup_thread.start()

+ 6
- 2
zuul/executor/server.py View File

@@ -2239,10 +2239,14 @@ class ExecutorServer(object):
2239 2239
         ssl_cert = get_default(self.config, 'gearman', 'ssl_cert')
2240 2240
         ssl_ca = get_default(self.config, 'gearman', 'ssl_ca')
2241 2241
         self.merger_worker = ExecutorMergeWorker(self, 'Zuul Executor Merger')
2242
-        self.merger_worker.addServer(server, port, ssl_key, ssl_cert, ssl_ca)
2242
+        self.merger_worker.addServer(server, port, ssl_key, ssl_cert, ssl_ca,
2243
+                                     keepalive=True, tcp_keepidle=60,
2244
+                                     tcp_keepintvl=30, tcp_keepcnt=5)
2243 2245
         self.executor_worker = ExecutorExecuteWorker(
2244 2246
             self, 'Zuul Executor Server')
2245
-        self.executor_worker.addServer(server, port, ssl_key, ssl_cert, ssl_ca)
2247
+        self.executor_worker.addServer(server, port, ssl_key, ssl_cert, ssl_ca,
2248
+                                       keepalive=True, tcp_keepidle=60,
2249
+                                       tcp_keepintvl=30, tcp_keepcnt=5)
2246 2250
         self.log.debug("Waiting for server")
2247 2251
         self.merger_worker.waitForServer()
2248 2252
         self.executor_worker.waitForServer()

+ 3
- 1
zuul/merger/client.py View File

@@ -82,7 +82,9 @@ class MergeClient(object):
82 82
         ssl_ca = get_default(self.config, 'gearman', 'ssl_ca')
83 83
         self.log.debug("Connecting to gearman at %s:%s" % (server, port))
84 84
         self.gearman = MergeGearmanClient(self)
85
-        self.gearman.addServer(server, port, ssl_key, ssl_cert, ssl_ca)
85
+        self.gearman.addServer(server, port, ssl_key, ssl_cert, ssl_ca,
86
+                               keepalive=True, tcp_keepidle=60,
87
+                               tcp_keepintvl=30, tcp_keepcnt=5)
86 88
         self.log.debug("Waiting for gearman")
87 89
         self.gearman.waitForServer()
88 90
         self.jobs = set()

+ 3
- 1
zuul/merger/server.py View File

@@ -60,7 +60,9 @@ class MergeServer(object):
60 60
         ssl_cert = get_default(self.config, 'gearman', 'ssl_cert')
61 61
         ssl_ca = get_default(self.config, 'gearman', 'ssl_ca')
62 62
         self.worker = gear.TextWorker('Zuul Merger')
63
-        self.worker.addServer(server, port, ssl_key, ssl_cert, ssl_ca)
63
+        self.worker.addServer(server, port, ssl_key, ssl_cert, ssl_ca,
64
+                              keepalive=True, tcp_keepidle=60,
65
+                              tcp_keepintvl=30, tcp_keepcnt=5)
64 66
         self.log.debug("Waiting for server")
65 67
         self.worker.waitForServer()
66 68
         self.log.debug("Registering")

+ 3
- 1
zuul/rpcclient.py View File

@@ -29,7 +29,9 @@ class RPCClient(object):
29 29
     def __init__(self, server, port, ssl_key=None, ssl_cert=None, ssl_ca=None):
30 30
         self.log.debug("Connecting to gearman at %s:%s" % (server, port))
31 31
         self.gearman = gear.Client()
32
-        self.gearman.addServer(server, port, ssl_key, ssl_cert, ssl_ca)
32
+        self.gearman.addServer(server, port, ssl_key, ssl_cert, ssl_ca,
33
+                               keepalive=True, tcp_keepidle=60,
34
+                               tcp_keepintvl=30, tcp_keepcnt=5)
33 35
         self.log.debug("Waiting for gearman")
34 36
         self.gearman.waitForServer()
35 37
 

+ 3
- 1
zuul/rpclistener.py View File

@@ -48,7 +48,9 @@ class RPCListener(object):
48 48
         ssl_cert = get_default(self.config, 'gearman', 'ssl_cert')
49 49
         ssl_ca = get_default(self.config, 'gearman', 'ssl_ca')
50 50
         self.worker = gear.TextWorker('Zuul RPC Listener')
51
-        self.worker.addServer(server, port, ssl_key, ssl_cert, ssl_ca)
51
+        self.worker.addServer(server, port, ssl_key, ssl_cert, ssl_ca,
52
+                              keepalive=True, tcp_keepidle=60,
53
+                              tcp_keepintvl=30, tcp_keepcnt=5)
52 54
         self.log.debug("Waiting for server")
53 55
         self.worker.waitForServer()
54 56
         self.log.debug("Registering")

Loading…
Cancel
Save