Merge branch 'develop' of ssh://github.com/alice-lg/alice-lg into develop
This commit is contained in:
commit
bd2d0b61ee
@ -120,7 +120,7 @@ func main() {
|
|||||||
log.Println("Using configuration:", cfg.File)
|
log.Println("Using configuration:", cfg.File)
|
||||||
|
|
||||||
// Start stores
|
// Start stores
|
||||||
if cfg.Server.EnablePrefixLookup == true {
|
if cfg.Server.EnablePrefixLookup {
|
||||||
go neighborsStore.Start()
|
go neighborsStore.Start()
|
||||||
go routesStore.Start()
|
go routesStore.Start()
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,9 @@ func (s *Server) apiNeighborsList(
|
|||||||
// from the summary.
|
// from the summary.
|
||||||
if s.neighborsStore.IsInitialized(rsID) {
|
if s.neighborsStore.IsInitialized(rsID) {
|
||||||
status, err := s.neighborsStore.GetStatus(rsID)
|
status, err := s.neighborsStore.GetStatus(rsID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
neighbors, err := s.neighborsStore.GetNeighborsAt(ctx, rsID)
|
neighbors, err := s.neighborsStore.GetNeighborsAt(ctx, rsID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -97,7 +97,7 @@ func Test_RoutesParsing(t *testing.T) {
|
|||||||
config := Config{Timezone: "UTC"} // Or ""
|
config := Config{Timezone: "UTC"} // Or ""
|
||||||
bird, _ := parseTestResponse(APIResponseRoutes)
|
bird, _ := parseTestResponse(APIResponseRoutes)
|
||||||
|
|
||||||
routes, err := parseRoutes(bird, config)
|
routes, err := parseRoutes(bird, config, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
6
pkg/store/backends/postgres/package.go
Normal file
6
pkg/store/backends/postgres/package.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
// Package postgres is an implementation of a routes and neighbors
|
||||||
|
// store using the postgres database.
|
||||||
|
//
|
||||||
|
// Routes and neighbors are stored as jsonb information
|
||||||
|
// with indexes for query performance.
|
||||||
|
package postgres
|
@ -113,6 +113,7 @@ func TestGetNeighbors(t *testing.T) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
t.Error("Unknown source should have yielded zero results")
|
t.Error("Unknown source should have yielded zero results")
|
||||||
}
|
}
|
||||||
|
t.Log(neighbors)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
pkg/store/package.go
Normal file
8
pkg/store/package.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Package store provides an interface for keeping
|
||||||
|
// routes and neighbor information without querying
|
||||||
|
// a route server. The refresh happens in a configurable
|
||||||
|
// interval.
|
||||||
|
//
|
||||||
|
// There a currently two implementations: A postgres and
|
||||||
|
// and in-memory backend.
|
||||||
|
package store
|
@ -318,5 +318,4 @@ func (s *SourcesStore) RefreshError(
|
|||||||
status.LastRefresh = time.Now().UTC()
|
status.LastRefresh = time.Now().UTC()
|
||||||
status.LastRefreshDuration = time.Since(status.lastRefreshStart)
|
status.LastRefreshDuration = time.Since(status.lastRefreshStart)
|
||||||
status.LastError = sourceErr
|
status.LastError = sourceErr
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user