Where is the crontab expression?

I don't see it.
10 Replies
Percy
Percyβ€’11mo ago
Project ID: 8696ee9c-3668-496c-a647-619282236f46
𓆩♑π“†ͺ
𓆩♑π“†ͺOPβ€’11mo ago
8696ee9c-3668-496c-a647-619282236f46
Brody
Brodyβ€’11mo ago
in the service settings
𓆩♑π“†ͺ
𓆩♑π“†ͺOPβ€’11mo ago
I dont understand how it works I need to run this this task every day
# lib/tasks/scheduler.rake
namespace :scheduler do
desc 'Expire old job postings'
task expire_job_postings: :environment do
puts 'Expiring old job postings...'
# logic to expire job postings
JobPosting.where('application_deadline < ?', Time.current)
.where(is_expired: false)
.update_all(is_expired: true)
JobPosting.reindex!
puts 'Done.'
end
end
# lib/tasks/scheduler.rake
namespace :scheduler do
desc 'Expire old job postings'
task expire_job_postings: :environment do
puts 'Expiring old job postings...'
# logic to expire job postings
JobPosting.where('application_deadline < ?', Time.current)
.where(is_expired: false)
.update_all(is_expired: true)
JobPosting.reindex!
puts 'Done.'
end
end
Brody
Brodyβ€’11mo ago
if you are running an in code scheduler you have no need to railways cron scheduler
𓆩♑π“†ͺ
𓆩♑π“†ͺOPβ€’11mo ago
this is really strange, I understand cron jobs but I don't understand how railway uses it do I need to define it for railway somewhere?
Brody
Brodyβ€’11mo ago
you are using an in code scheduler, you have no need for railways cron scheduler. what issues are you facing specifically?
𓆩♑π“†ͺ
𓆩♑π“†ͺOPβ€’11mo ago
I have defined the cron job up. How do I run it natively on railway? as I understood it has built-in cron jobs so I don't have to install a gem for it
Brody
Brodyβ€’11mo ago
deploy your repo with the applicable start command to start your in code cron scheduler, nothing special to it. but again, you are already using an in code cron scheduler you have no need for railways cron scheduler
𓆩♑π“†ͺ
𓆩♑π“†ͺOPβ€’11mo ago
I think the docs need to be improved or the UI.
Want results from more Discord servers?
Add your server