diff --git a/os/gcron/gcron.go b/os/gcron/gcron.go index 6f067445adb..0e375185c74 100644 --- a/os/gcron/gcron.go +++ b/os/gcron/gcron.go @@ -121,7 +121,7 @@ func Stop(name ...string) { defaultCron.Stop(name...) } -// GracefulStop Blocks and waits all current running jobs done. -func GracefulStop() { - defaultCron.GracefulStop() +// StopGracefully Blocks and waits all current running jobs done. +func StopGracefully() { + defaultCron.StopGracefully() } diff --git a/os/gcron/gcron_cron.go b/os/gcron/gcron_cron.go index 61c49da7571..2588de4c071 100644 --- a/os/gcron/gcron_cron.go +++ b/os/gcron/gcron_cron.go @@ -189,8 +189,8 @@ func (c *Cron) Stop(name ...string) { } } -// GracefulStop Blocks and waits all current running jobs done. -func (c *Cron) GracefulStop() { +// StopGracefully Blocks and waits all current running jobs done. +func (c *Cron) StopGracefully() { c.status.Set(StatusStopped) c.jobWaiter.Wait() } diff --git a/os/gcron/gcron_z_example_1_test.go b/os/gcron/gcron_z_example_1_test.go index 1a6269e6085..40027cda826 100644 --- a/os/gcron/gcron_z_example_1_test.go +++ b/os/gcron/gcron_z_example_1_test.go @@ -43,6 +43,6 @@ func ExampleCronGracefulShutdown() { glog.Printf(ctx, "Signal received: %s, stopping cron", sig) glog.Print(ctx, "Waiting for all cron jobs to complete...") - gcron.GracefulStop() + gcron.StopGracefully() glog.Print(ctx, "All cron jobs completed") } diff --git a/os/gcron/gcron_z_unit_test.go b/os/gcron/gcron_z_unit_test.go index c1655a1242f..1f92a3d8e5f 100644 --- a/os/gcron/gcron_z_unit_test.go +++ b/os/gcron/gcron_z_unit_test.go @@ -313,7 +313,7 @@ func TestCron_JobWaiter(t *testing.T) { glog.Printf(ctx, "Signal received: %s, stopping cron", sig) glog.Print(ctx, "Waiting for all cron jobs to complete...") - gcron.GracefulStop() + gcron.StopGracefully() glog.Print(ctx, "All cron jobs completed") t.Assert(s1.Len(), 4) t.Assert(s2.Len(), 2)