Skip to content

feat: Add IsRunning() method to query scheduler state #232

@CybotTM

Description

@CybotTM

Summary

Add a method to query whether the scheduler is currently running.

Upstream Reference

Problem

Currently there's no way to check if a scheduler is running:

c := cron.New()
c.Start()

// Later in code...
// How do I know if c is running?

Proposed API

c := cron.New()
fmt.Println(c.IsRunning()) // false

c.Start()
fmt.Println(c.IsRunning()) // true

c.Stop()
fmt.Println(c.IsRunning()) // false

Use Cases

  • Conditional start (avoid double-start)
  • Health checks and monitoring
  • Graceful shutdown coordination
  • Debugging and logging

Priority

Lower - Small quality-of-life improvement.

Implementation Notes

Simple implementation using existing running field. Should be thread-safe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestupstreamIssues from upstream robfig/cron

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions