Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to close or reset the connection #257

Open
cargonzalv opened this issue Feb 5, 2020 · 4 comments
Open

No way to close or reset the connection #257

cargonzalv opened this issue Feb 5, 2020 · 4 comments

Comments

@cargonzalv
Copy link

My electron application runs a simple query every 10 seconds to get the latest invoice of a POS' ADODB database. This works for a while but after 2-3 days the query stops working and it shows the following error:

image

The only way to resolve this issue is closing the app completely and opening it again, then it starts working again for 2-3 days until the same issue happens again. I tried "resetting" the connection with the following code:

async GetDBList(size: number) {
   try {
            this.COUNT_TRY++;
            let data: any = await this.db.query("query to get the invoices");
            this.COUNT_TRY = 0;
            return data;
   }
   catch (ex) {
            if (this.COUNT_TRY <= this.MAX_COUNT_TRY) {
                this.db = ADODB.open(this.connectionString, this.x64);
                await sleep(400);
                return await this.GetDBList(size)
            }
            else {
                log.error("GamaSoft:GetDBList:catch:", ex);
                log.error(JSON.stringify(ex));
                return undefined;
            }
       }
   }

I thought by doing this i would be resetting the connection every time it fails, but the error keeps happening and the only way I have right now of really resetting the connection and making everything work correctly again is closing the app completely and opening it again.

@cargonzalv
Copy link
Author

@nuintun

@nuintun
Copy link
Owner

nuintun commented Feb 23, 2020

It will automatically close the connection L72, but now I find it has some bugs. I will fixed in the next version!

@cargonzalv
Copy link
Author

@nuintun Great! Thanks

@HyperSprite
Copy link

I've run into this same issue, any progress or anything I can do to help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants