See:
|
def destroyed_activity(instance) |
|
return unless StreamRails.enabled? |
As opposed to:
|
def created_activity(instance) |
|
return unless StreamRails.enabled? && instance.activity_should_sync? |
I think this doesn't make sense. I guess you don't fail on record not found, but it still does an unwanted network call which can fail.
Our use case is to move Stream communication into background jobs. What we do for creation is default activity_should_sync? to false and then in the background job:
def perform(activity_id)
activity = Activity.find(activity_id)
activity.activity_should_sync = true
StreamRails.feed_manager.created_activity(activity)
end
Something similar would work for activity destroy too if activity_should_sync? were respected. The workaround is redefining remove_from_feed on the model:
def remove_from_feed; end
See:
stream-rails/lib/stream_rails/feed_manager.rb
Lines 58 to 59 in 8ffa4f1
As opposed to:
stream-rails/lib/stream_rails/feed_manager.rb
Lines 51 to 52 in 8ffa4f1
I think this doesn't make sense. I guess you don't fail on record not found, but it still does an unwanted network call which can fail.
Our use case is to move Stream communication into background jobs. What we do for creation is default
activity_should_sync?tofalseand then in the background job:Something similar would work for activity destroy too if
activity_should_sync?were respected. The workaround is redefiningremove_from_feedon the model: