Fix start problem with two IronFunction colliding configurations

By default, BoltDB will hang while waiting to acquire lock to the
datafile, thus the users might find themselves waiting for something
but not what. The added timeout aims inform use about what's
happening.

Also this renames MQADR to TASKSRV, refactor configuration to read
environment variables. RunAsyncRunner now fills the gaps when
parsing TASKSRV.

Fixes #119
This commit is contained in:
Carlos C
2016-10-04 23:45:02 +02:00
parent 3db24e2745
commit bc3fba088f
7 changed files with 83 additions and 63 deletions

View File

@@ -5,6 +5,7 @@ import (
"net/url"
"os"
"path/filepath"
"time"
"github.com/Sirupsen/logrus"
"github.com/boltdb/bolt"
@@ -29,7 +30,7 @@ func New(url *url.URL) (models.Datastore, error) {
return nil, err
}
log.Infoln("Creating bolt db at ", url.Path)
db, err := bolt.Open(url.Path, 0600, nil)
db, err := bolt.Open(url.Path, 0600, &bolt.Options{Timeout: 1 * time.Second})
if err != nil {
log.WithError(err).Errorln("Error on bolt.Open")
return nil, err