Skip to content

Entity destroy doesn't respect activity_should_sync? #96

@thisismydesign

Description

@thisismydesign

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions