mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-11 18:28:11 +00:00
Fix certificate watch hang
If no certificate present, then once a day confluent could hang. Fix by doing a non-blocking read on the watcher.
This commit is contained in:
parent
59e739a143
commit
e52556affb
@ -477,11 +477,14 @@ class SockApi(object):
|
||||
|
||||
def watch_for_cert(self):
|
||||
libc = ctypes.CDLL(ctypes.util.find_library('c'))
|
||||
watcher = libc.inotify_init()
|
||||
watcher = libc.inotify_init1(os.O_NONBLOCK)
|
||||
if libc.inotify_add_watch(watcher, b'/etc/confluent/', 0x100) > -1:
|
||||
while True:
|
||||
select.select((watcher,), (), (), 86400)
|
||||
os.read(watcher, 1024)
|
||||
try:
|
||||
os.read(watcher, 1024)
|
||||
except Exception:
|
||||
pass
|
||||
if self.should_run_remoteapi():
|
||||
os.close(watcher)
|
||||
self.start_remoteapi()
|
||||
|
Loading…
x
Reference in New Issue
Block a user