我只是为生产配置系统,我们选择了Heroku的Postgres Standard-0作为数据库。这表明最大连接数为120,但我知道这并不意味着我可以将Sequelize的from os import listdir
from os.path import isfile, join
#make sure to change this to your dir location and dont forget ending
#backslash
mypath="Your/Dir/Location/"
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
#sorts the files according to the years
#dummy value to rerun the program without worries if necessary
sortedList=sorted(onlyfiles,key=lambda x:int(x.split("_")[1].replace(".txt","")) if not "Years" in x else 10000)
print(sortedList)
import collections
#get a set of filename starters
fileNameSet=collections.OrderedDict.fromkeys(f.split("_")[0] for f in sortedList)
print(fileNameSet)
#iterate through the files for files starting with these names
for uniqueName in fileNameSet:
contentToWrite=""
for fileNames in sortedList:
if fileNames.startswith(uniqueName) and "Years" not in fileNames:
with open(mypath+fileNames,"r") as currFile:
contentToWrite+=currFile.read()
with open(mypath+uniqueName+"_allYears.txt","w+") as writeFile:
writeFile.write(contentToWrite)
设置为120,因为还有其他注意事项。
根据经验,什么是上POOL_MAX
设置?
答案 0 :(得分:0)
由于Heroku偶尔需要连接到数据库以执行运行状况检查和各种其他任务,因此不建议您将POOL_MAX
设置为120。大约110左右的数字似乎更合适,因为它将为Heroku留出监视数据库的空间,并允许几个额外的连接,以防您需要紧急连接到数据库。如果添加更多的测功机或让其他客户端定期连接到数据库,则需要向下调整POOL_MAX
设置以解决其他连接问题。