Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
032b6e96
Commit
032b6e96
authored
Jan 30, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't block forever is server is not up.
Refactor main() to report all errors and exit with non-zero status.
parent
e6b721b8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
9 deletions
+32
-9
src/scripts/zeopack.py
src/scripts/zeopack.py
+32
-9
No files found.
src/scripts/zeopack.py
View file @
032b6e96
...
...
@@ -18,15 +18,35 @@ Options:
You must specify either -p and -h or -U.
"""
import
getopt
import
socket
import
sys
import
time
from
ZEO.ClientStorage
import
ClientStorage
def
main
(
addr
,
storage
,
days
):
WAIT
=
10
# wait no more than 10 seconds for client to connect
def
connect
(
storage
):
# The connect-on-startup logic that ZEO provides isn't too useful
# for this script. We'd like to client to attempt to startup, but
# fail if it can't get through to the server after a reasonable
# amount of time. There's no external support for this, so we'll
# expose the ZEO 1.0 internals. (consenting adults only)
t0
=
time
.
time
()
while
t0
+
WAIT
>
time
.
time
():
storage
.
_call
.
connect
()
if
storage
.
_connected
:
return
raise
RuntimeError
,
"Unable to connect to ZEO server"
def
pack
(
addr
,
storage
,
days
):
cs
=
ClientStorage
(
addr
,
storage
=
storage
,
wait_for_server_on_startup
=
1
)
# _startup() is an artifact of the way ZEO 1.0 works. The
# ClientStorage doesn't get fully initialized until registerDB()
# is called. The only thing we care about, though, is that
# registerDB() calls _startup().
c
s
.
_startup
(
)
c
onnect
(
cs
)
cs
.
pack
(
wait
=
1
,
days
=
days
)
def
usage
(
exit
=
1
):
...
...
@@ -34,11 +54,7 @@ def usage(exit=1):
print
" "
.
join
(
sys
.
argv
)
sys
.
exit
(
exit
)
if
__name__
==
"__main__"
:
import
getopt
import
socket
import
sys
def
main
():
host
=
None
port
=
None
unix
=
None
...
...
@@ -70,4 +86,11 @@ if __name__ == "__main__":
usage
()
addr
=
host
,
port
main
(
addr
,
storage
,
days
)
pack
(
addr
,
storage
,
days
)
if
__name__
==
"__main__"
:
try
:
main
()
except
Exception
,
err
:
print
err
sys
.
exit
(
1
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment