adding workaround for expired check sessions
Signed-off-by: Divya Dadlani <ddadlani@pivotal.io> Co-authored-by: Krishna Mannem <kmannem@pivotal.io>
This commit is contained in:
parent
4d25a1f9ec
commit
0d2ef89f77
|
@ -337,7 +337,6 @@ func (scanner *resourceScanner) check(
|
|||
}
|
||||
return err
|
||||
}
|
||||
fmt.Println("heres the owner in scanner", owner)
|
||||
container, err := chosenWorker.FindOrCreateContainer(
|
||||
context.Background(),
|
||||
logger,
|
||||
|
@ -347,6 +346,13 @@ func (scanner *resourceScanner) check(
|
|||
resourceTypes,
|
||||
)
|
||||
if err != nil {
|
||||
// TODO: remove this after ephemeral check containers.
|
||||
// Sometimes we pass in a check session thats too close to
|
||||
// expirey into FindOrCreateContainer such that the container
|
||||
// gced before the call is completed
|
||||
if err == worker.ResourceConfigCheckSessionExpiredError {
|
||||
return nil
|
||||
}
|
||||
logger.Error("failed-to-create-or-find-container", err)
|
||||
chkErr := resourceConfigScope.SetCheckError(err)
|
||||
if chkErr != nil {
|
||||
|
|
|
@ -22,6 +22,8 @@ import (
|
|||
|
||||
const userPropertyName = "user"
|
||||
|
||||
var ResourceConfigCheckSessionExpiredError = errors.New("no db container was found for owner")
|
||||
|
||||
//go:generate counterfeiter . Worker
|
||||
|
||||
type Worker interface {
|
||||
|
@ -189,19 +191,17 @@ func (worker *gardenWorker) FindOrCreateContainer(
|
|||
err error
|
||||
)
|
||||
|
||||
fmt.Println("heres the owner ", owner)
|
||||
creatingContainer, createdContainer, err = worker.dbWorker.FindContainer(owner)
|
||||
if err != nil {
|
||||
logger.Error("failed-to-find-container-in-db", err)
|
||||
return nil, err
|
||||
}
|
||||
fmt.Println("thsee are the handles", creatingContainer, createdContainer)
|
||||
if creatingContainer != nil {
|
||||
containerHandle = creatingContainer.Handle()
|
||||
} else if createdContainer != nil {
|
||||
containerHandle = createdContainer.Handle()
|
||||
} else {
|
||||
return nil, errors.New("no db container was found for owner")
|
||||
return nil, ResourceConfigCheckSessionExpiredError
|
||||
}
|
||||
|
||||
gardenContainer, err = worker.gardenClient.Lookup(containerHandle)
|
||||
|
|
|
@ -29,38 +29,16 @@ services:
|
|||
CONCOURSE_ADD_LOCAL_USER: test:test,guest:guest
|
||||
CONCOURSE_MAIN_TEAM_LOCAL_USER: test
|
||||
CONCOURSE_CLUSTER_NAME: dev
|
||||
CONCOURSE_CONTAINER_PLACEMENT_STRATEGY: fewest-build-containers
|
||||
|
||||
worker1:
|
||||
worker:
|
||||
build: .
|
||||
image: concourse/concourse:local
|
||||
command: worker
|
||||
privileged: true
|
||||
depends_on: [web]
|
||||
# ports:
|
||||
# - 7777:7777
|
||||
# - 7788:7788
|
||||
stop_signal: SIGUSR2
|
||||
environment:
|
||||
CONCOURSE_LOG_LEVEL: debug
|
||||
CONCOURSE_TSA_HOST: web:2222
|
||||
|
||||
# avoid using loopbacks
|
||||
CONCOURSE_BAGGAGECLAIM_DRIVER: overlay
|
||||
|
||||
# # so we can reach Garden/Baggageclaim for debugging
|
||||
# CONCOURSE_BIND_IP: 0.0.0.0
|
||||
# CONCOURSE_BAGGAGECLAIM_BIND_IP: 0.0.0.0
|
||||
|
||||
worker2:
|
||||
build: .
|
||||
image: concourse/concourse:local
|
||||
command: worker
|
||||
privileged: true
|
||||
depends_on: [web]
|
||||
# ports:
|
||||
# - 7777:7777
|
||||
# - 7788:7788
|
||||
ports:
|
||||
- 7777:7777
|
||||
- 7788:7788
|
||||
stop_signal: SIGUSR2
|
||||
environment:
|
||||
CONCOURSE_LOG_LEVEL: debug
|
||||
|
@ -70,5 +48,5 @@ services:
|
|||
CONCOURSE_BAGGAGECLAIM_DRIVER: overlay
|
||||
|
||||
# so we can reach Garden/Baggageclaim for debugging
|
||||
# CONCOURSE_BIND_IP: 0.0.0.0
|
||||
# CONCOURSE_BAGGAGECLAIM_BIND_IP: 0.0.0.0
|
||||
CONCOURSE_BIND_IP: 0.0.0.0
|
||||
CONCOURSE_BAGGAGECLAIM_BIND_IP: 0.0.0.0
|
||||
|
|
Loading…
Reference in New Issue