Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0b29cb59
Commit
0b29cb59
authored
Dec 04, 2015
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate EE jobs from Sidetiq to Sidekiq-cron
parent
8534b4c6
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
23 deletions
+29
-23
app/workers/historical_data_worker.rb
app/workers/historical_data_worker.rb
+0
-3
app/workers/ldap_sync_worker.rb
app/workers/ldap_sync_worker.rb
+0
-9
app/workers/update_all_mirrors_worker.rb
app/workers/update_all_mirrors_worker.rb
+0
-3
config/gitlab.yml.example
config/gitlab.yml.example
+4
-7
config/initializers/sidekiq.rb
config/initializers/sidekiq.rb
+1
-1
config/schedule.yml
config/schedule.yml
+24
-0
No files found.
app/workers/historical_data_worker.rb
View file @
0b29cb59
class
HistoricalDataWorker
class
HistoricalDataWorker
include
Sidekiq
::
Worker
include
Sidekiq
::
Worker
include
Sidetiq
::
Schedulable
recurrence
{
daily
.
hour_of_day
(
12
)
}
def
perform
def
perform
HistoricalData
.
track!
HistoricalData
.
track!
...
...
app/workers/ldap_sync_worker.rb
View file @
0b29cb59
class
LdapSyncWorker
class
LdapSyncWorker
include
Sidekiq
::
Worker
include
Sidekiq
::
Worker
include
Sidetiq
::
Schedulable
sidekiq_options
retry:
false
sidekiq_options
retry:
false
if
Gitlab
.
config
.
ldap
.
enabled
DAILY
=
Gitlab
.
config
.
ldap
.
schedule_sync_daily
HOUR
=
Gitlab
.
config
.
ldap
.
schedule_sync_hour
MINUTE
=
Gitlab
.
config
.
ldap
.
schedule_sync_minute
recurrence
{
daily
(
DAILY
).
hour_of_day
(
HOUR
).
minute_of_hour
(
MINUTE
)
}
end
def
perform
def
perform
Rails
.
logger
.
info
"Performing daily LDAP sync task."
Rails
.
logger
.
info
"Performing daily LDAP sync task."
User
.
ldap
.
find_each
(
batch_size:
100
).
each
do
|
ldap_user
|
User
.
ldap
.
find_each
(
batch_size:
100
).
each
do
|
ldap_user
|
...
...
app/workers/update_all_mirrors_worker.rb
View file @
0b29cb59
class
UpdateAllMirrorsWorker
class
UpdateAllMirrorsWorker
include
Sidekiq
::
Worker
include
Sidekiq
::
Worker
include
Sidetiq
::
Schedulable
recurrence
{
hourly
}
def
perform
def
perform
Project
.
mirror
.
each
(
&
:update_mirror
)
Project
.
mirror
.
each
(
&
:update_mirror
)
...
...
config/gitlab.yml.example
View file @
0b29cb59
...
@@ -170,13 +170,10 @@ production: &base
...
@@ -170,13 +170,10 @@ production: &base
ldap:
ldap:
enabled: false
enabled: false
# GitLab EE only.
#
# In addition to refreshing users when they log in,
# Gitlab EE only:
# enabling this setting will refresh LDAP user membership once a day.
# Since Gitlab 8.3, LDAP refresh job execution can be configured in schedule.yml
# Default time of the day when this will happen is at 1:30am server time.
#
schedule_sync_daily: 1 # Run once every X days. Default: 1, meaning 'daily'
schedule_sync_hour: 1 # Hour of the day. Value from 0-23.
schedule_sync_minute: 30 # Minute of the hour. Value from 0-59.
servers:
servers:
##########################################################################
##########################################################################
...
...
config/initializers/sidekiq.rb
View file @
0b29cb59
...
@@ -21,7 +21,7 @@ Sidekiq.configure_server do |config|
...
@@ -21,7 +21,7 @@ Sidekiq.configure_server do |config|
# Sidekiq-cron: load recurring jobs from schedule.yml
# Sidekiq-cron: load recurring jobs from schedule.yml
schedule_file
=
'config/schedule.yml'
schedule_file
=
'config/schedule.yml'
if
File
.
exists?
(
schedule_file
)
if
File
.
exists?
(
schedule_file
)
Sidekiq
::
Cron
::
Job
.
load_from_hash
YAML
.
load
_file
(
schedule_file
)
Sidekiq
::
Cron
::
Job
.
load_from_hash
YAML
.
load
(
ERB
.
new
(
File
.
read
(
schedule_file
)).
result
)
end
end
end
end
...
...
config/schedule.yml
View file @
0b29cb59
...
@@ -8,3 +8,27 @@ stuck_ci_builds_worker:
...
@@ -8,3 +8,27 @@ stuck_ci_builds_worker:
cron
:
"
0
0
*
*
*"
cron
:
"
0
0
*
*
*"
class
:
"
StuckCiBuildsWorker"
class
:
"
StuckCiBuildsWorker"
queue
:
"
default"
queue
:
"
default"
#
# GitLab EE only jobs:
#
historical_data_worker
:
cron
:
"
0
12
*
*
*"
class
:
"
HistoricalDataWorker"
queue
:
"
default"
update_all_mirrors_worker
:
cron
:
"
0
*
*
*
*"
class
:
"
UpdateAllMirrorsWorker"
queue
:
"
default"
<% if Gitlab.config.ldap.enabled %>
# In addition to refreshing users when they log in,
# enabling this setting will refresh LDAP user membership once a day.
# Default time of the day when this will happen is at 1:30am server time.
ldap_sync_worker
:
cron
:
"
30
1
*
*
*"
class
:
"
LdapSyncWorker"
queue
:
"
default"
<% end %>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment