mirror of https://github.com/kiwix/libkiwix.git
Thread safe dumping of the OPDS feed
This commit is contained in:
parent
473d2d2a69
commit
ad2eb52553
|
@ -108,10 +108,15 @@ BooksData getBooksData(const Library* library, const std::vector<std::string>& b
|
||||||
{
|
{
|
||||||
BooksData booksData;
|
BooksData booksData;
|
||||||
for ( const auto& bookId : bookIds ) {
|
for ( const auto& bookId : bookIds ) {
|
||||||
const Book& book = library->getBookById(bookId);
|
try {
|
||||||
booksData.push_back(kainjow::mustache::object{
|
const Book book = library->getBookByIdThreadSafe(bookId);
|
||||||
{"entry", getSingleBookEntryXML(book, false, endpointRoot, partial)}
|
booksData.push_back(kainjow::mustache::object{
|
||||||
});
|
{"entry", getSingleBookEntryXML(book, false, endpointRoot, partial)}
|
||||||
|
});
|
||||||
|
} catch ( const std::out_of_range& ) {
|
||||||
|
// the book was removed from the library since its id was obtained
|
||||||
|
// ignore it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return booksData;
|
return booksData;
|
||||||
|
|
Loading…
Reference in New Issue