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

Add async support #6

Open
sarahhodne opened this issue Jul 3, 2011 · 6 comments
Open

Add async support #6

sarahhodne opened this issue Jul 3, 2011 · 6 comments

Comments

@sarahhodne
Copy link
Contributor

Defensio supports asynchronous requests, and Defender should as well. This might shorten the load times on web sites.

@ghost ghost assigned sarahhodne Jul 3, 2011
@blim8183
Copy link

How is progress going on this? Have you thought about how you might go about implementing it? I was thinking of taking a shot at it but don't want to if you've already done a significant amount of work on it.

@sarahhodne
Copy link
Contributor Author

I haven't really written any code for this yet, feel free to have a go at it. I'm thinking that this and #7 is related, since both "require" you to parse the defensio response outside the before_create filter.

@blim8183
Copy link

Defensio does have the option of providing a callback URL so they can POST the results of a comment back to you. This probably wouldn't require the use of background workers, right?

@sarahhodne
Copy link
Contributor Author

I'm sorry, I was thinking of an odd way of implementing this. Basically what you need is a way to tell the model, or Defender, "hey, I got this from Defensio, please do something with it!"

@kule
Copy link

kule commented Oct 25, 2012

EDIT: Forgot to say I'm working on this at the mo!

From my point of view I'd rather it dealt with it as much as possible i.e. what I have at the moment is:

  1. Set Defender.async_callback_url (basically a create/post method for a controller that will handle the callbacks)
  2. Defender will automatically add on a model param to the url so it knows which class to change
  3. Submit to defensio with async settings
  4. Callback comes to a controller (manually created by user); in the create method you just need this line: Defender.handle_defensio_callback(request)
  5. It will automatically determine the the correct model, search by defensio_sig & update the spam status

Obviously this is going to add a few extra requirements from Rails:

  • I'd like to use constantize from ActiveSupport
  • A finder method - find_by_defensio_sig
  • I'd also like to trap ActiveRecord::RecordNotFound errors and re-raise them as Defender errors with a bit more info (probably the comment was deleted)

Are you okay with me adding these extra as dependencies or do you have a better way of doing this that doesn't tie it down so much?

@kule
Copy link

kule commented Oct 25, 2012

Just to give you an idea of where I'm going with this:

https://gist.github.com/3953544

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants