vendredi 17 juillet 2015

node.js intelligent sqlite access with errorhandling

I am habing a code where I access the database multiple times so I often get and sqlite busy error because I do not wait long enough.

What would be the best way to handle these errors. My approach was the following.

try{
    accessDB()
}catch(err){
    setTimeout(accessDB, 100);  
}

But it does not seem to work properly. If I allways wait a second it works but this seems bad for the performance. What would be the right way to handle this?

Aucun commentaire:

Enregistrer un commentaire