Heroku Postgres: This connection has been closed

后端 未结 2 1882
傲寒
傲寒 2021-01-18 06:05

I developed a small Heroku + Grails + Postreg application. It would work fine somewhat 20 minutes after deployment, after that I always get:

 This connection         


        
2条回答
  •  半阙折子戏
    2021-01-18 06:30

    I have resolved it myself by adding this to DataSource.groovy:

    dataSource {
        pooled = true
        properties {
           maxActive = -1
           minEvictableIdleTimeMillis=1800000
           timeBetweenEvictionRunsMillis=1800000
           numTestsPerEvictionRun=3
           testOnBorrow=true
           testWhileIdle=true
           testOnReturn=true
           validationQuery="SELECT 1"
        }
    }
    

提交回复
热议问题