Skip to content

Commit

Permalink
adding log point on source.set error
Browse files Browse the repository at this point in the history
  • Loading branch information
ivolo committed Mar 20, 2017
1 parent 2415344 commit 1ff5aa8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions segment_source_resource/sync.py
@@ -1,4 +1,5 @@
import typing
import json

from gevent.pool import Pool
from gevent.thread import Greenlet
Expand Down Expand Up @@ -42,9 +43,15 @@ def _process_resource(resources: typing.List[Resource], seed: typing.Any, resour
else:
obj = resource.transform(raw_obj, seed)

source.set(obj.collection, obj.id, obj.properties)
thread = threads.spawn(_enqueue_children, resources, raw_obj, resource)
thread.link_exception(_create_error_handler(resource.collection))
try:
source.set(obj.collection, obj.id, obj.properties)
thread = threads.spawn(_enqueue_children, resources, raw_obj, resource)
thread.link_exception(_create_error_handler(resource.collection))
except:
# if there's an object being set that the server rejects, this log point
# will print it out so we can address it in the logs
print('source.set({}, {}, {})'.format(obj.collection, obj.id, json.dumps(obj.properties)))
raise

threads.join()

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -4,7 +4,7 @@
setup(
name='segment_source_resource',
packages=['segment_source_resource'],
version='0.9.10',
version='0.9.11',
description='Abstraction to make sources easier to write',
author='Segment',
author_email='friends@segment.com',
Expand Down

0 comments on commit 1ff5aa8

Please sign in to comment.