diff --git a/pkg/server/api/api-bucket-handlers.go b/pkg/server/api/bucket-handlers.go similarity index 100% rename from pkg/server/api/api-bucket-handlers.go rename to pkg/server/api/bucket-handlers.go diff --git a/pkg/server/api/api-definitions.go b/pkg/server/api/definitions.go similarity index 100% rename from pkg/server/api/api-definitions.go rename to pkg/server/api/definitions.go diff --git a/pkg/server/api/api-generic-handlers.go b/pkg/server/api/generic-handlers.go similarity index 100% rename from pkg/server/api/api-generic-handlers.go rename to pkg/server/api/generic-handlers.go diff --git a/pkg/server/api/api-logging-handlers.go b/pkg/server/api/logging-handlers.go similarity index 100% rename from pkg/server/api/api-logging-handlers.go rename to pkg/server/api/logging-handlers.go diff --git a/pkg/server/api/api-object-handlers.go b/pkg/server/api/object-handlers.go similarity index 100% rename from pkg/server/api/api-object-handlers.go rename to pkg/server/api/object-handlers.go diff --git a/pkg/server/api/api-ratelimit-handlers.go b/pkg/server/api/ratelimit-handlers.go similarity index 100% rename from pkg/server/api/api-ratelimit-handlers.go rename to pkg/server/api/ratelimit-handlers.go diff --git a/pkg/server/api/api-response.go b/pkg/server/api/response.go similarity index 100% rename from pkg/server/api/api-response.go rename to pkg/server/api/response.go diff --git a/pkg/storage/pq/pq_test.go b/pkg/storage/pq/pq_test.go index 0723d273f..b070324fa 100644 --- a/pkg/storage/pq/pq_test.go +++ b/pkg/storage/pq/pq_test.go @@ -30,24 +30,44 @@ type MySuite struct{} var _ = Suite(&MySuite{}) -func helloTask1() error { - fmt.Println("Hello task1") - return nil +func helloTask1() <-chan error { + errCh := make(chan error) + go func() { + defer close(errCh) + println("Hello task1") + errCh <- nil + }() + return errCh } -func helloTask2() error { - fmt.Println("Hello task2") - return nil +func helloTask2() <-chan error { + errCh := make(chan error) + go func() { + defer close(errCh) + println("Hello task2") + errCh <- nil + }() + return errCh } -func newJob1() error { - fmt.Println("New Job1") - return nil +func newJob1() <-chan error { + errCh := make(chan error) + go func() { + defer close(errCh) + println("New Job1") + errCh <- nil + }() + return errCh } -func newJob2() error { - fmt.Println("New Job2") - return nil +func newJob2() <-chan error { + errCh := make(chan error) + go func() { + defer close(errCh) + println("New Job2") + errCh <- nil + }() + return errCh } func (s *MySuite) TestPQ(c *C) { diff --git a/pkg/storage/pq/task.go b/pkg/storage/pq/task.go index 1c092fbd5..9a1f3e84d 100644 --- a/pkg/storage/pq/task.go +++ b/pkg/storage/pq/task.go @@ -18,7 +18,7 @@ package pq // Task container for any generic tasks type Task struct { - job func() error + job func() <-chan error priority int } @@ -34,5 +34,5 @@ func (t Task) UpdatePriority(p int) { // Execute execute current task func (t Task) Execute() error { - return t.job() + return <-t.job() }