summaryrefslogtreecommitdiffstats
path: root/modules/queue/queue_channel.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-02-02 23:19:58 +0000
committerGitHub <noreply@github.com>2020-02-02 23:19:58 +0000
commit2c903383b5154795b90e4b4ed8eaadc6fac17a13 (patch)
treed5ca361d9597e027ad92f1e02a841be1d266b554 /modules/queue/queue_channel.go
parentb4914249ee389a733e7dcfd2df20708ab3215827 (diff)
downloadgitea-2c903383b5154795b90e4b4ed8eaadc6fac17a13.tar.gz
gitea-2c903383b5154795b90e4b4ed8eaadc6fac17a13.zip
Add Unique Queue infrastructure and move TestPullRequests to this (#9856)
* Upgrade levelqueue to version 0.2.0 This adds functionality for Unique Queues * Add UniqueQueue interface and functions to create them * Add UniqueQueue implementations * Move TestPullRequests over to use UniqueQueue * Reduce code duplication * Add bytefifos * Ensure invalid types are logged * Fix close race in PersistableChannelQueue Shutdown
Diffstat (limited to 'modules/queue/queue_channel.go')
-rw-r--r--modules/queue/queue_channel.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/modules/queue/queue_channel.go b/modules/queue/queue_channel.go
index 45df8a443e..d7a11e79f5 100644
--- a/modules/queue/queue_channel.go
+++ b/modules/queue/queue_channel.go
@@ -53,31 +53,31 @@ func NewChannelQueue(handle HandlerFunc, cfg, exemplar interface{}) (Queue, erro
}
// Run starts to run the queue
-func (c *ChannelQueue) Run(atShutdown, atTerminate func(context.Context, func())) {
+func (q *ChannelQueue) Run(atShutdown, atTerminate func(context.Context, func())) {
atShutdown(context.Background(), func() {
- log.Warn("ChannelQueue: %s is not shutdownable!", c.name)
+ log.Warn("ChannelQueue: %s is not shutdownable!", q.name)
})
atTerminate(context.Background(), func() {
- log.Warn("ChannelQueue: %s is not terminatable!", c.name)
+ log.Warn("ChannelQueue: %s is not terminatable!", q.name)
})
- log.Debug("ChannelQueue: %s Starting", c.name)
+ log.Debug("ChannelQueue: %s Starting", q.name)
go func() {
- _ = c.AddWorkers(c.workers, 0)
+ _ = q.AddWorkers(q.workers, 0)
}()
}
// Push will push data into the queue
-func (c *ChannelQueue) Push(data Data) error {
- if !assignableTo(data, c.exemplar) {
- return fmt.Errorf("Unable to assign data: %v to same type as exemplar: %v in queue: %s", data, c.exemplar, c.name)
+func (q *ChannelQueue) Push(data Data) error {
+ if !assignableTo(data, q.exemplar) {
+ return fmt.Errorf("Unable to assign data: %v to same type as exemplar: %v in queue: %s", data, q.exemplar, q.name)
}
- c.WorkerPool.Push(data)
+ q.WorkerPool.Push(data)
return nil
}
// Name returns the name of this queue
-func (c *ChannelQueue) Name() string {
- return c.name
+func (q *ChannelQueue) Name() string {
+ return q.name
}
func init() {