Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(t) replication spawn error #2766 #2777

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/rockstor/scripts/scheduled_tasks/send_replica.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Copyright (c) 2012-2020 RockStor, Inc. <http://rockstor.com>
Copyright (c) 2012-2023 RockStor, Inc. <https://rockstor.com>
This file is part of RockStor.

RockStor is free software; you can redistribute it and/or modify
Expand All @@ -13,7 +13,7 @@
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""

import sys
Expand All @@ -28,25 +28,27 @@ def main():
rid = int(sys.argv[1])
ctx = zmq.Context()
poll = zmq.Poller()
num_tries = 12
num_tries = 3
while True:
req = ctx.socket(zmq.DEALER)
poll.register(req, zmq.POLLIN)
req.connect("ipc://%s" % settings.REPLICATION.get("ipc_socket"))
req.send_multipart(["new-send", b"%d" % rid])
ipc_socket = settings.REPLICATION.get("ipc_socket")
req.connect(f"ipc://{ipc_socket}")
req.send_multipart([b"new-send", f"{rid}".encode("utf-8")])

socks = dict(poll.poll(5000))
if socks.get(req) == zmq.POLLIN:
rcommand, reply = req.recv_multipart()
if rcommand == "SUCCESS":
print(f"rcommand={rcommand}, reply={reply}")
if rcommand == b"SUCCESS":
print(reply)
break
ctx.destroy(linger=0)
sys.exit(reply)
num_tries -= 1
print(
"No response from Replication service. Number of retry "
"attempts left: %d" % num_tries
f"attempts left: {num_tries}"
)
if num_tries == 0:
ctx.destroy(linger=0)
Expand Down
Loading