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

Feat: name scheduler threads + redirect error logging #102

Merged
merged 4 commits into from Jan 19, 2022

Conversation

kares
Copy link
Contributor

@kares kares commented Jan 17, 2022

The gist of the work here is to avoid STDERR.puts from Rufus::Scheduler#on_error as well as
to set a Thread#name (which than sets Java thread name) for threads started by rufus-scheduler.

Threads started by a particular plugin will use a common prefix - making them identifiable from Java thread dumps:

  • [#{id}]<jdbc__scheduler is used for the scheduler thread
  • [#{id}]<jdbc__scheduler_worker-00 will be the name of the first started worker thread

NOTE: extracted from #97

- redirecting potential logs to LS logger
- setting thread name for scheduler threads
- any worker threads started are also named
# Rufus::Scheduler >= 3.4 moved the Time impl into a gem EoTime = ::EtOrbi::EoTime`
# Rufus::Scheduler 3.1 - 3.3 using it's own Time impl `Rufus::Scheduler::ZoTime`
TimeImpl = defined?(Rufus::Scheduler::EoTime) ? Rufus::Scheduler::EoTime :
(defined?(Rufus::Scheduler::ZoTime) ? Rufus::Scheduler::ZoTime : ::Time)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for now LS is locked to rufus-scheduler 3.0.9 but this is compatible with any version >= 3.0.9
(there's an upgrade pending at: #97)

@kares kares marked this pull request as ready for review January 17, 2022 08:00
@andsel andsel self-requested a review January 19, 2022 09:33
Copy link
Contributor

@andsel andsel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Tried locally with LS 7.16.1, building the gem and installing, and on launched LS

jstack <LS_pid> | grep -i "jdbc__"

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

Successfully merging this pull request may close these issues.

None yet

3 participants