Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity destroy doesn't respect activity_should_sync? #96

Open
thisismydesign opened this issue Apr 23, 2019 · 0 comments
Open

Entity destroy doesn't respect activity_should_sync? #96

thisismydesign opened this issue Apr 23, 2019 · 0 comments

Comments

@thisismydesign
Copy link

thisismydesign commented Apr 23, 2019

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
@thisismydesign thisismydesign changed the title Entity destroy doesn't respect instance.activity_should_sync? Entity destroy doesn't respect activity_should_sync? Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant