mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-01 22:04:02 +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:
@@ -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