0xPolygonHermez / zkevm-bridge-service

Other
68 stars 68 forks source link

Duplicate DB configs #584

Closed bap2pecs closed 2 months ago

bap2pecs commented 8 months ago

SyncDB and BridgeServer.DB in https://github.com/0xPolygonHermez/zkevm-bridge-service/blob/develop/config/default.go are actually the same thing

if we look into https://github.com/0xPolygonHermez/zkevm-bridge-service/blob/develop/cmd/run.go, SyncDB is only used once to run migrations and the following lines

apiStorage, err := db.NewStorage(c.BridgeServer.DB)

connects to the DB

there is no other references of SyncDB in the entire codebase

so I'd recommend just keep one of them

ARR552 commented 2 months ago

Hi, yes. You are right. The idea is let the api to point to a db read replica. All the write operations use the write replica. This allows us to reduce the db load and keep the performance