Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
agkyra
Commits
36f5d30f
Commit
36f5d30f
authored
May 21, 2015
by
Giorgos Korfiatis
Browse files
always clear hearbeat when sync fails
parent
9111f177
Changes
2
Hide whitespace changes
Inline
Side-by-side
agkyra/syncer/file_client.py
View file @
36f5d30f
...
...
@@ -41,14 +41,14 @@ class FileClient(object):
if
callback
is
not
None
:
callback
(
synced_source_state
,
synced_target_state
)
except
common
.
SyncError
as
e
:
hard
=
isinstance
(
e
,
common
.
HardSyncError
)
if
failure_callback
is
not
None
:
failure_callback
(
source_handle
.
source_state
,
hard
=
hard
)
msg
=
messaging
.
SyncErrorMessage
(
objname
=
target_state
.
objname
,
serial
=
source_handle
.
source_state
.
serial
,
exception
=
e
,
logger
=
logger
)
self
.
settings
.
messager
.
put
(
msg
)
if
isinstance
(
e
,
common
.
HardSyncError
):
if
failure_callback
is
not
None
:
failure_callback
(
source_handle
.
source_state
)
def
_start
(
self
,
source_handle
,
target_state
,
sync_state
):
try
:
...
...
agkyra/syncer/syncer.py
View file @
36f5d30f
...
...
@@ -288,16 +288,17 @@ class FileSyncer(object):
callback
=
self
.
ack_file_sync
,
failure_callback
=
self
.
mark_as_failed
)
def
mark_as_failed
(
self
,
state
):
def
mark_as_failed
(
self
,
state
,
hard
=
False
):
serial
=
state
.
serial
objname
=
state
.
objname
logger
.
warning
(
"Marking failed serial %s for archive: %s, object: '%s'"
%
(
serial
,
state
.
archive
,
objname
))
with
self
.
heartbeat
.
lock
()
as
hb
:
hb
.
pop
(
objname
)
with
self
.
failed_serials
.
lock
()
as
d
:
d
[(
serial
,
objname
)]
=
state
if
hard
:
logger
.
warning
(
"Marking failed serial %s for archive: %s, object: '%s'"
%
(
serial
,
state
.
archive
,
objname
))
with
self
.
failed_serials
.
lock
()
as
d
:
d
[(
serial
,
objname
)]
=
state
def
update_state
(
self
,
old_state
,
new_state
):
db
=
self
.
get_db
()
...
...
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