Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
shinji62 committed Jun 8, 2018
2 parents 5f743b5 + 56f6998 commit 232336a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
27 changes: 11 additions & 16 deletions caching/caching_boltdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,26 +167,21 @@ func (c *CachingBolt) getAppFromCache(appGuid string) (*App, error) {
}

func (c *CachingBolt) getAllAppsFromBoltDB() (map[string]*App, error) {
var allData [][]byte
c.appdb.View(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte(APP_BUCKET))
b.ForEach(func(guid []byte, v []byte) error {
allData = append(allData, v)
apps := make(map[string]*App)
err := c.appdb.View(func(tx *bolt.Tx) error {
return tx.Bucket([]byte(APP_BUCKET)).ForEach(func(guid []byte, v []byte) error {
var app App
err := json.Unmarshal(v, &app)
if err != nil {
return err
}
apps[app.Guid] = &app
return nil
})
return nil
})

apps := make(map[string]*App, len(allData))
for i := range allData {
var app App
err := json.Unmarshal(allData[i], &app)
if err != nil {
return nil, err
}
apps[app.Guid] = &app
if err != nil {
return nil, err
}

return apps, nil
}

Expand Down
1 change: 1 addition & 0 deletions eventRouting/event_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type EventFilter func(*fevents.Event) bool
//HasIgnoreField Filter out the event has ignored app filed
func HasIgnoreField(event *fevents.Event) bool {
ignored, hasIgnoredField := event.Fields["cf_ignored_app"]
delete(event.Fields, "cf_ignored_app")
return ignored == true && hasIgnoredField
}

Expand Down

0 comments on commit 232336a

Please sign in to comment.