Commit f33ce0f6 authored by Anton Melser's avatar Anton Melser 💬

Add AnkrobesServer.close() method

This will hopefully unlock the db
Signed-off-by: default avatarAnton Melser <[email protected]>
parent 8eb0c4b0
......@@ -28,6 +28,11 @@ class AnkrobesServer:
self.col = col
def close(self):
# Close the DB connection so other threads can lock it for the
# user in question
self.col.close()
# copied from old
def is_known(self, token):
# TODO: This method should take into account the POS but we'll need to implement that in Anki somehow
......
......@@ -61,6 +61,7 @@ def _push_note_to_ankrobes(request, review_in):
status = server.set_word_known(simplified=simplified, pinyin=pinyin, meanings=[meanings],
tags=tags, review_in=review_in)
server.close()
data = {"status": 'ok' if status else 'ko' }
logger.debug("I got a {} back from ankrobes".format(data))
......@@ -97,6 +98,7 @@ def helloapi(request):
server = AnkrobesServer(username)
status = server.add_ankrobes_note(simplified, pinyin, [meanings], ['chromecrobes'])
server.close()
data = {"status": 'ok' if status else 'ko' }
logging.debug("I got a {} back from ankrobes".format(data))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment