zongji
zongji copied to clipboard
start() options ignored if server already connected
I tried something like:
const zongji = new ZongJi({
host: argv['source-host'],
user: argv['source-user'],
password: argv['source-password'],
charset: 'utf8mb4'
});
someAsyncCode(function () {
zongji.start({
startAtEnd: true,
includeEvents: ['tablemap', 'writerows', 'updaterows', 'deleterows', 'rotate'],
includeSchema: includeSchema
});
});
I realized that my options (including startAtEnd
) were ignored by ZongJi. I suspect it's because the connection is already established by the time I call .start()
. It's not a critical problem but it'd be great if it was mentioned in the doc.
Thanks for the great work!
I just came across this issue today as well. The binlogOptions
set in _init()
are not overwritten when start()
is called. If start()
is called before all of the async initialization takes place, this works fine, but if zongji is created well before start()
is called, then generateBinlog()
already happened and the filename/startpos cannot change.
It seems like the fix is to move the ready
function into start()
. I think you should be able to set most if not all of the options
that are sent to generateBinlog
after construction anyways.
Burned by this. Seems best to pass the options as the second parameter to the Zongji constructor, even though the docs say to pass startAtEnd
to the start function.