fn: reduce lbagent and agent dependency (#938)

* fn: reduce lbagent and agent dependency

lbagent and agent code is too dependent. This causes
any changed in agent to break lbagent. In reality, for
LB there should be no delegated agent. Splitting these
two will cause some code duplication, but it reduces
dependency and complexity (eg. agent without docker)

* fn: post rebase fixup

* fn: runner/runnercall should use lbDeadline

* fn: fixup ln agent test

* fn: remove agent create option for common.WaitGroup
This commit is contained in:
Tolga Ceylan
2018-04-12 15:51:58 -07:00
committed by GitHub
parent e53d23afc9
commit e47d55056a
12 changed files with 197 additions and 118 deletions

View File

@@ -17,7 +17,15 @@ func (a *agent) AddCallListener(listener fnext.CallListener) {
}
func (a *agent) fireBeforeCall(ctx context.Context, call *models.Call) error {
for _, l := range a.callListeners {
return fireBeforeCallFun(a.callListeners, ctx, call)
}
func (a *agent) fireAfterCall(ctx context.Context, call *models.Call) error {
return fireAfterCallFun(a.callListeners, ctx, call)
}
func fireBeforeCallFun(callListeners []fnext.CallListener, ctx context.Context, call *models.Call) error {
for _, l := range callListeners {
err := l.BeforeCall(ctx, call)
if err != nil {
return err
@@ -26,8 +34,8 @@ func (a *agent) fireBeforeCall(ctx context.Context, call *models.Call) error {
return nil
}
func (a *agent) fireAfterCall(ctx context.Context, call *models.Call) error {
for _, l := range a.callListeners {
func fireAfterCallFun(callListeners []fnext.CallListener, ctx context.Context, call *models.Call) error {
for _, l := range callListeners {
err := l.AfterCall(ctx, call)
if err != nil {
return err