Skip to content

Commit

Permalink
Added github collect statistics job and open sidekiq UI to the admin …
Browse files Browse the repository at this point in the history
…role
  • Loading branch information
BRIMIL01 committed Oct 10, 2018
1 parent 1b9df78 commit 6100dd7
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 18 deletions.
1 change: 0 additions & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,6 @@ Style/RescueStandardError:
- 'app/lib/json_web_token.rb'
- 'app/lib/send_grid_client.rb'
- 'config/initializers/core_extensions/devise/strategies/json_web_token.rb'
- 'lib/tasks/git_hub.rake'
- 'lib/tasks/meetup.rake'
- 'lib/tasks/resource.rake'
- 'lib/tasks/users.rake'
Expand Down
2 changes: 1 addition & 1 deletion .ruby-gemset
Original file line number Diff line number Diff line change
@@ -1 +1 @@
operationcode_backend
-global
11 changes: 11 additions & 0 deletions app/jobs/github_collect_statistics_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class GithubCollectStatisticsJob
include Sidekiq::Worker

def perform
limit = GitHub::Client.new.rate_limit
logger.info("Github Ratelimit: #{limit}")

GitHub::PullRequests.new.fetch_and_save!
GitHub::Issues.new.fetch_and_save!
end
end
6 changes: 6 additions & 0 deletions config/job_schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ meetup_member_sync_job:
cron: "0 4 * * *"
class: "MeetupMemberSyncJob"
queue: "default"

# At 03:00 every day run the github collect statistics job
github_collect_statistics_job:
cron: "0 3 * * *"
class: "GithubCollectStatisticsJob"
queue: "default"
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

require 'sidekiq/web'
require 'sidekiq/cron/web'
authenticate :admin_user, ->(u) { u.role.super_admin? } do
authenticate :admin_user, ->(u) { u.role.admin_accessible? } do
mount Sidekiq::Web => '/admin/sidekiq'
end

Expand Down
15 changes: 0 additions & 15 deletions lib/tasks/git_hub.rake

This file was deleted.

0 comments on commit 6100dd7

Please sign in to comment.