Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Too, too many objects #23

Open
wants to merge 2 commits into from

4 participants

@maletor

Temporary solution until there is such time for pagination.

@timoschilling

I think we should do this via pagination and not with a static limit.
If @maletor and @akshayrawat confirm with me, i would implement Kaminari for the pagination

@akshayrawat
Owner

Go for it. Make the pagination url params optional so that the iphone client still works as it is. Also, take into account pagination behavior when jobs are deleted from a page.

You could use kaminari or more simply an endless pagination pattern like Twitter's endless list of tweets on the web-ui - that can be implemented by simple jquery i think.

Try to keep it dead simple, write tests and I guess we could do it both for AR and Mongoid at once.

Let me know if you have any more questions or need to discuss the approach further.

Thanks

@akshayrawat
Owner

Endless lists is a common pattern on mobile UIs.

@akshayrawat
Owner

Pagination might not be coming soon. So this might be a decent solution for now.

We will just show the last 500 results. Need to implement this for mongoid too.

@maletor
@timoschilling

kaminari came tomorrow

@adahl

any timeline for when pagination will be implemented? dj_mon works well for a few hundred jobs, but with thousands, it completely breaks down.

@akshayrawat
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 10, 2012
  1. @maletor
Commits on Sep 12, 2012
  1. @maletor
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/dj_mon/backend/activerecord.rb
View
12 lib/dj_mon/backend/activerecord.rb
@@ -3,29 +3,29 @@ module Backend
module ActiveRecord
class << self
def all
- Delayed::Job.all
+ Delayed::Job.last(500)
end
def failed
- Delayed::Job.where('delayed_jobs.failed_at IS NOT NULL')
+ Delayed::Job.where('delayed_jobs.failed_at IS NOT NULL').last(500)
end
def active
- Delayed::Job.where('delayed_jobs.failed_at IS NULL AND delayed_jobs.locked_by IS NOT NULL')
+ Delayed::Job.where('delayed_jobs.failed_at IS NULL AND delayed_jobs.locked_by IS NOT NULL').last(500)
end
def queued
- Delayed::Job.where('delayed_jobs.failed_at IS NULL AND delayed_jobs.locked_by IS NULL')
+ Delayed::Job.where('delayed_jobs.failed_at IS NULL AND delayed_jobs.locked_by IS NULL').last(500)
end
def destroy id
dj = Delayed::Job.find(id)
- dj.destroy if dj
+ dj.destroy
end
def retry id
dj = Delayed::Job.find(id)
- dj.update_attributes({ failed_at: nil }) if dj
+ dj.update_attributes({ failed_at: nil })
end
end
end
Something went wrong with that request. Please try again.