fireshaper / TiredTechnician

A handheld library technician to add books to your LazyLibrarian server.
10 stars 0 forks source link

A few suggestions... #1

Closed philborman closed 6 years ago

philborman commented 6 years ago

Looks good, I have made a few changes to the api though which might make it easier. queueBook now returns an error if the book id is not recognised. This means the sleep() after queueBook is not needed. Also the sleep after addBook is not ideal as we are waiting for goodreads to get back to us and it could be a while. addBook doesn't put the bookID into the database until it gets the reply from goodreads so it would be safer to call addBook then poll queueBook in a loop until you get "OK". You could maybe sleep a second in the loop, maybe add a limit on how many tries? Hope this helps :-)

fireshaper commented 6 years ago

@philborman Thanks! That worked perfectly. What's the longest you've seen it take for GoodReads to return a response? I didn't add a max tries yet, but I do like the idea if it becomes a problem.

philborman commented 6 years ago

I've had goodreads timeout completely on occasion, might be the vpn I'm using though. LazyLibrarian will trap timeout at 30 seconds by default, and also some very long result lists can take a while to return as they are paginated, eg findBook&name=Star+Wars can take nearly a minute but each individual page doesn't exceed the timeout.