Skip to content

Commit 21008fe

Browse files
committed
SCFF-46 commented code lines not being usedin eventRouting and not filling the db
1 parent 314ee71 commit 21008fe

5 files changed

Lines changed: 16 additions & 28 deletions

File tree

caching/caching_boltdb.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func NewCachingBolt(gcfClientSet *cfClient.Client, boltDatabasePath string) Cach
3434
}
3535

3636
func (c *CachingBolt) CreateBucket() {
37+
//start to write inside the db
3738
c.Appdb.Update(func(tx *bolt.Tx) error {
3839
_, err := tx.CreateBucketIfNotExists([]byte("AppBucket"))
3940
if err != nil {
@@ -65,7 +66,6 @@ func (c *CachingBolt) fillDatabase(listApps []App) {
6566
if err != nil {
6667
return fmt.Errorf("create bucket: %s", err)
6768
}
68-
6969
serialize, err := json.Marshal(app)
7070

7171
if err != nil {
@@ -98,7 +98,8 @@ func (c *CachingBolt) GetAppByGuid(appGuid string) []App {
9898
app.SpaceData.Entity.OrgData.Entity.Guid,
9999
c.isOptOut(app.Environment),
100100
})
101-
c.fillDatabase(apps)
101+
//commented for not filling the db
102+
// c.fillDatabase(apps)
102103
return apps
103104

104105
}
@@ -130,8 +131,8 @@ func (c *CachingBolt) GetAllApp() []App {
130131
c.isOptOut(app.Environment),
131132
})
132133
}
133-
134-
c.fillDatabase(apps)
134+
//commented for not filling the db
135+
//c.fillDatabase(apps)
135136
//fmt.Printf("Found [%d] Apps!", len(apps))
136137

137138
return apps

eventRouting/eventRouting_suite_test.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

eventRouting/eventrouting.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ import (
55
"sort"
66
"strings"
77
"sync"
8-
"time"
98

109
"bitbucket.org/mcplusa-ondemand/firehose-to-sumologic/caching"
1110
"bitbucket.org/mcplusa-ondemand/firehose-to-sumologic/eventQueue"
1211
fevents "bitbucket.org/mcplusa-ondemand/firehose-to-sumologic/events"
13-
"bitbucket.org/mcplusa-ondemand/firehose-to-sumologic/sumoCFFirehose"
14-
"github.com/Sirupsen/logrus"
1512
"github.com/cloudfoundry/sonde-go/events"
1613
)
1714

@@ -20,16 +17,14 @@ type EventRouting struct {
2017
selectedEvents map[string]bool
2118
selectedEventsCount map[string]uint64
2219
mutex *sync.Mutex
23-
sLAppender sumoCFFirehose.SumoLogicAppender //**
2420
queue *eventQueue.Queue
2521
}
2622

27-
func NewEventRouting(caching caching.Caching, sLAppender sumoCFFirehose.SumoLogicAppender, queue *eventQueue.Queue) *EventRouting {
23+
func NewEventRouting(caching caching.Caching, queue *eventQueue.Queue) *EventRouting {
2824
return &EventRouting{
2925
CachingClient: caching,
3026
selectedEvents: make(map[string]bool),
3127
selectedEventsCount: make(map[string]uint64),
32-
sLAppender: sLAppender, //**
3328
queue: queue,
3429
mutex: &sync.Mutex{},
3530
}
@@ -118,7 +113,7 @@ func GetListAuthorizedEventEvents() (authorizedEvents string) {
118113
return strings.Join(arrEvents, ", ")
119114
}
120115

121-
func (e *EventRouting) GetTotalCountOfSelectedEvents() uint64 {
116+
/*func (e *EventRouting) GetTotalCountOfSelectedEvents() uint64 {
122117
var total = uint64(0)
123118
for _, count := range e.GetSelectedEventsCount() {
124119
total += count
@@ -148,9 +143,9 @@ func (e *EventRouting) LogEventTotals(logTotalsTime time.Duration) {
148143
e.queue.Push(event)
149144
}
150145
}()
151-
}
146+
}*/
152147

153-
func (e *EventRouting) getEventTotals(totalElapsedTime float64, elapsedTime float64, lastCount uint64) (*fevents.Event, uint64) {
148+
/*func (e *EventRouting) getEventTotals(totalElapsedTime float64, elapsedTime float64, lastCount uint64) (*fevents.Event, uint64) {
154149
e.mutex.Lock()
155150
defer e.mutex.Unlock()
156151
totalCount := e.GetTotalCountOfSelectedEvents()
@@ -172,3 +167,4 @@ func (e *EventRouting) getEventTotals(totalElapsedTime float64, elapsedTime floa
172167
event.AnnotateWithMetaData(map[string]string{})
173168
return event, totalCount
174169
}
170+
*/

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func main() {
8585
go loggingClientSumo.Start() //multi
8686

8787
logging.Info.Println("Creating Events")
88-
events := eventRouting.NewEventRouting(cachingClient, *loggingClientSumo, &queue)
88+
events := eventRouting.NewEventRouting(cachingClient, &queue)
8989
err := events.SetupEventRouting(*wantedEvents)
9090
if err != nil {
9191
logging.Error.Fatal("Error setting up event routing: ", err)

tile-history.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ history:
66
- 0.0.4
77
- 0.0.5
88
- 0.0.6
9-
version: 0.0.7
9+
- 0.0.7
10+
- 0.0.8
11+
- 0.0.9
12+
- 0.0.10
13+
version: 0.0.11

0 commit comments

Comments
 (0)