forked from mirrors/homebox
79f7ad40cb
* add user profiles and theme selectors * lowercase buttons by default * basic layout * (wip) init token APIs * refactor server to support variable options * fix types * api refactor / registration tests * implement UI for url and join * remove console.logs * rename repository factory * fix upload size
22 lines
498 B
Go
22 lines
498 B
Go
package server
|
|
|
|
// TODO: #2 Implement Go routine pool/job queue
|
|
|
|
type Worker interface {
|
|
Add(func())
|
|
}
|
|
|
|
// SimpleWorker is a simple background worker that implements
|
|
// the Worker interface and runs all tasks in a go routine without
|
|
// a pool or que or limits. It's useful for simple or small applications
|
|
// with minimal/short background tasks
|
|
type SimpleWorker struct {
|
|
}
|
|
|
|
func NewSimpleWorker() *SimpleWorker {
|
|
return &SimpleWorker{}
|
|
}
|
|
|
|
func (sw *SimpleWorker) Add(task func()) {
|
|
go task()
|
|
}
|