(db_config)
| 13 | |
| 14 | @staticmethod |
| 15 | def get_db_instance(db_config): |
| 16 | if not RetryPostgresqlDatabase._instance: |
| 17 | RetryPostgresqlDatabase._instance = RetryPostgresqlDatabase( |
| 18 | db_config.get('database'), |
| 19 | host=db_config.get('host'), |
| 20 | user=db_config.get('user'), |
| 21 | password=db_config.get('password'), |
| 22 | port=db_config.get('port'), |
| 23 | max_connections=10, |
| 24 | autoconnect=True, |
| 25 | ) |
| 26 | else: |
| 27 | if RetryPostgresqlDatabase._instance.database != db_config.get('database'): |
| 28 | RetryPostgresqlDatabase._instance = RetryPostgresqlDatabase( |
| 29 | db_config.get('database'), |
| 30 | host=db_config.get('host'), |
| 31 | user=db_config.get('user'), |
| 32 | password=db_config.get('password'), |
| 33 | port=db_config.get('port'), |
| 34 | max_connections=10, |
| 35 | autoconnect=True, |
| 36 | ) |
| 37 | |
| 38 | return RetryPostgresqlDatabase._instance |
| 39 | |
| 40 | |
| 41 | def gen_db(db_config): |
no test coverage detected