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
3704589f
Commit
3704589f
authored
May 19, 2015
by
Giorgos Korfiatis
Browse files
Send message when syncing fails
parent
7c570add
Changes
2
Hide whitespace changes
Inline
Side-by-side
agkyra/syncer/file_client.py
View file @
3704589f
...
...
@@ -16,7 +16,7 @@
import
logging
logger
=
logging
.
getLogger
(
__name__
)
from
agkyra.syncer
import
common
from
agkyra.syncer
import
common
,
messaging
class
FileClient
(
object
):
...
...
@@ -41,7 +41,11 @@ class FileClient(object):
if
callback
is
not
None
:
callback
(
synced_source_state
,
synced_target_state
)
except
common
.
SyncError
as
e
:
logger
.
warning
(
e
)
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
)
...
...
agkyra/syncer/messaging.py
View file @
3704589f
...
...
@@ -71,6 +71,17 @@ class AckSyncMessage(Message):
(
self
.
archive
,
self
.
objname
,
self
.
serial
))
class
SyncErrorMessage
(
Message
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
Message
.
__init__
(
self
,
*
args
,
**
kwargs
)
self
.
objname
=
kwargs
[
"objname"
]
self
.
serial
=
kwargs
[
"serial"
]
self
.
exception
=
kwargs
[
"exception"
]
self
.
logger
.
warning
(
"Sync failed; object: '%s' serial: %s error: %s"
%
(
self
.
objname
,
self
.
serial
,
self
.
exception
))
class
CollisionMessage
(
Message
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
Message
.
__init__
(
self
,
*
args
,
**
kwargs
)
...
...
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