Fix bndname in replication
This commit is contained in:
3
db.py
3
db.py
@@ -2,6 +2,7 @@ from datetime import datetime
|
||||
from typing import List, Optional
|
||||
from sqlalchemy import create_engine, String, select, ForeignKey, Enum
|
||||
from sqlalchemy.orm import Session, DeclarativeBase, Mapped, mapped_column, relationship
|
||||
from config import Config
|
||||
|
||||
|
||||
def tow(day: int, hour: int, minute: int):
|
||||
@@ -133,4 +134,4 @@ class Schemas(Base):
|
||||
|
||||
|
||||
def connect_db():
|
||||
return create_engine("postgresql+psycopg://postgres:Root12345678@10.10.8.83:32101/db")
|
||||
return create_engine(f"postgresql+psycopg://{Config.pg_username}:{Config.pg_password}@{Config.pg_host}:{Config.pg_port}/{Config.pg_dbname}")
|
||||
|
||||
3
main.py
3
main.py
@@ -70,7 +70,6 @@ def run_tasks():
|
||||
|
||||
def replication_task():
|
||||
while True:
|
||||
print()
|
||||
conn = db.connect_db()
|
||||
with Session(conn) as session:
|
||||
for bndname in connected:
|
||||
@@ -241,7 +240,7 @@ def replication(bnd_name: str, commit_id: str, schema: str):
|
||||
ET.SubElement(res, 'replication', {'id': commit_id, 'scheme': schema})
|
||||
response_params = {
|
||||
'from': f'tcp://{Config.self_bnd}',
|
||||
'to': f'tcp://{Config.remote_bnd}',
|
||||
'to': f'tcp://{bnd_name}',
|
||||
'ts_added': date.timestamp(),
|
||||
'user_id': '0',
|
||||
'query_type': NEW_REPLICATION_REQUEST,
|
||||
|
||||
Reference in New Issue
Block a user