mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-30 11:23:20 +08:00
Checks to make sure that an Event has a type before checking type.
The Dividend event is currently missing 'type', causing the type check to fail. TODO: Add a type to Dividends.
This commit is contained in:
1 parent
26ff73072c
commit
79f7fe69ef
1 file changed
+4
-3
@@ -136,7 +136,8 @@ class StatefulTransform(object):
|
||||
log.info('Running StatefulTransform [%s]' % self.get_hash())
|
||||
for message in stream_in:
|
||||
# we only handle TRADE events.
|
||||
if message.type != DATASOURCE_TYPE.TRADE:
|
||||
if (hasattr(message, 'type')
|
||||
and message.type != DATASOURCE_TYPE.TRADE):
|
||||
continue
|
||||
# allow upstream generators to yield None to avoid
|
||||
# blocking.
|
||||
@@ -217,8 +218,8 @@ class EventWindow(object):
|
||||
|
||||
def update(self, event):
|
||||
|
||||
if event.type != DATASOURCE_TYPE.TRADE:
|
||||
continue
|
||||
if hasattr(event, 'type') and event.type != DATASOURCE_TYPE.TRADE:
|
||||
return
|
||||
|
||||
self.assert_well_formed(event)
|
||||
# Add new event and increment totals.
|
||||
|
||||
Reference in new issue
Block a user