Merge pull request #31 from 30x/refactor-haoming
Refactor haoming
diff --git a/apigee_sync_test.go b/apigee_sync_test.go
index 96a780a..cebe7cc 100644
--- a/apigee_sync_test.go
+++ b/apigee_sync_test.go
@@ -113,7 +113,12 @@
})
}
})
- apid.InitializePlugins()
+ //apid.InitializePlugins()
+ pie := apid.PluginsInitializedEvent{
+ Description: "plugins initialized",
+ }
+ pie.Plugins = append(pie.Plugins, pluginData)
+ postInitPlugins(pie)
}, 3)
//this test has a dependency on the one above it. Ideally we would write a test db to the disk instead
@@ -123,7 +128,7 @@
* In general, any additional sync tests (or any tests causing postInitPlugins to fire)
* will need to re-register the plugin
*/
- apid.RegisterPlugin(initPlugin)
+ //apid.RegisterPlugin(initPlugin)
expectedTables := common.ChangeList{
Changes: []common.Change{common.Change{Table: "kms.company"},
@@ -147,7 +152,12 @@
close(done)
}
})
- apid.InitializePlugins()
+ //apid.InitializePlugins()
+ pie := apid.PluginsInitializedEvent{
+ Description: "plugins initialized",
+ }
+ pie.Plugins = append(pie.Plugins, pluginData)
+ postInitPlugins(pie)
}, 3)
diff --git a/token.go b/token.go
index e461e70..c9cf438 100644
--- a/token.go
+++ b/token.go
@@ -29,7 +29,6 @@
func createTokenManager() *tokenMan {
t := &tokenMan{}
t.doRefresh = make(chan bool, 1)
- t.continueMaintenance = true
t.maintainToken()
return t
}
@@ -62,7 +61,7 @@
log.Debug("auto refresh token")
}
- if t.token.needsRefresh() && t.continueMaintenance{
+ if t.token.needsRefresh() {
getTokenLock.Lock()
t.retrieveNewToken()
getTokenLock.Unlock()
@@ -95,7 +94,6 @@
log.Debug("close token manager")
quitPollingForToken <- true
close(t.doRefresh)
- t.continueMaintenance = false
}
// don't call externally. will block until success.