Skip to content

Commit

Permalink
fix re-open queue, update ui
Browse files Browse the repository at this point in the history
  • Loading branch information
reddec committed Jul 20, 2020
1 parent aa0385d commit 1bbdfbf
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
10 changes: 5 additions & 5 deletions application/queuemanager/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (qm *queueManager) addQueueUnsafe(queue application.Queue) error {

q = &queueDefinition{
Queue: queue,
worker: startWorker(qm.ctx, back, queue.Target, qm.platform, &qm.wg),
worker: startWorker(qm.ctx, queue.Name, back, queue.Target, qm.platform, &qm.wg),
queue: back,
}
if qm.queues == nil {
Expand Down Expand Up @@ -138,7 +138,7 @@ func (qm *queueManager) Assign(queue string, targetLambda string) error {
q.worker.stop()
<-q.worker.done
q.Target = targetLambda
q.worker = startWorker(qm.ctx, q.queue, targetLambda, qm.platform, &qm.wg)
q.worker = startWorker(qm.ctx, queue, q.queue, targetLambda, qm.platform, &qm.wg)
return qm.config.SetQueues(qm.listUnsafe())
}

Expand Down Expand Up @@ -185,7 +185,7 @@ type worker struct {
done chan struct{}
}

func startWorker(gctx context.Context, queue queue.Queue, uid string, plt Platform, wg *sync.WaitGroup) *worker {
func startWorker(gctx context.Context, name string, queue queue.Queue, uid string, plt Platform, wg *sync.WaitGroup) *worker {
ctx, cancel := context.WithCancel(gctx)
w := &worker{
stop: cancel,
Expand All @@ -205,9 +205,9 @@ func startWorker(gctx context.Context, queue queue.Queue, uid string, plt Platfo
}

if err != nil {
log.Println("queues: failed peek")
log.Println("queues: failed peek", name, ":", err)
} else if err = plt.InvokeByUID(ctx, uid, *req, os.Stderr); err != nil {
log.Println("queues: failed invoke:", err)
log.Println("queues: failed invoke by uid", uid, "from queue", name, ":", err)
}
err = queue.Commit(ctx)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions assets/bindata.go
Git LFS file not shown
9 changes: 8 additions & 1 deletion docs/usage/queues.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ Since `0.3.5`
By default, queues stored in a directory-based style. Each element of queue pipes directly from
incoming requests, as well as to lambda without caching. It means - RAM usage is almost constant regardless
of requests sizes and number of elements in a queue.


Currently, there are not security restrictions for the queue on append time. All checks will be performed before lambda
execution in same way as it defined in security.

Queues that bound to the lambda could be found in Overview -> Endpoint page.

Queue can be re-assigned to another lambda without destroy.

Designed for

Expand All @@ -31,3 +37,4 @@ Allowed queue name: latin letters, numbers and dash up. From 3 to 64 symbols len

One queue always linked to one lambda, but one lambda can be linked to multiple queues.


2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/google/uuid v1.1.1
github.com/jessevdk/go-flags v1.4.1-0.20180331124232-1c38ed7ad0cc
github.com/philhofer/fwd v1.0.0 // indirect
github.com/reddec/dfq v0.0.0-20200716124604-b347d756a38c
github.com/reddec/dfq v0.0.0-20200720022748-4befa9f0e225
github.com/reddec/jsonrpc2 v0.1.18
github.com/robfig/cron v1.2.0
github.com/stretchr/testify v1.5.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ github.com/reddec/dfq v0.0.0-20200715120610-5e45d6cc3525 h1:jg6PJi3G9DxsR8qQ6ISo
github.com/reddec/dfq v0.0.0-20200715120610-5e45d6cc3525/go.mod h1:bm9WMLIEIvDiGGBnP4I68xEToCNrjwW9h/57coRF85w=
github.com/reddec/dfq v0.0.0-20200716124604-b347d756a38c h1:tKG0C1oACT46G3PtrlUEHbCGp/+aLuW9fGx0LA8WU7E=
github.com/reddec/dfq v0.0.0-20200716124604-b347d756a38c/go.mod h1:bm9WMLIEIvDiGGBnP4I68xEToCNrjwW9h/57coRF85w=
github.com/reddec/dfq v0.0.0-20200720022748-4befa9f0e225 h1:IOC2onOgDY9vaDSnIeg7zGNzSvrZv2VTxSTviiCQXzI=
github.com/reddec/dfq v0.0.0-20200720022748-4befa9f0e225/go.mod h1:bm9WMLIEIvDiGGBnP4I68xEToCNrjwW9h/57coRF85w=
github.com/reddec/godetector v0.0.0-20200420065712-f938e1104afe/go.mod h1:CzQ4Kf0yOsagWbBdC+5pRPJxMnL1uO3/7DimjqEr6Q8=
github.com/reddec/jsonrpc2 v0.1.18 h1:yeVtTlRcbsyAWcXE70E51NKgcFg6T/NqOSNmsEQotws=
github.com/reddec/jsonrpc2 v0.1.18/go.mod h1:heiBKpIJpxXGrQ3W9YKahxgfD6yCsnBsqBedjSOSTQI=
Expand Down

0 comments on commit 1bbdfbf

Please sign in to comment.