![]() |
#1 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,952
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Sporadic virtual library recursion
On my virtual_libraries() column, I get spordaic "recursion detected when processing..." errors, which affect one of my reading-status VLs (though it seems to pick them at random).
The error disappears upon making an edit to a book (or even opening the MDE and saving without any changes). I'm trying to figure out where the recursion may be coming from. All three VLs use a template search checking a stored template, readstatus(). Currently Reading: Code:
template:"program:readstatus()#@#:t:~(currentlyreading|toberead)" Code:
template:"program:readstatus()#@#:t:=unread" Code:
template:"program:readstatus()#@#:t:=read" Code:
program: if ($$#percentread >=#1 && $$#percentread <=#99) || ($#readinglist == 'Reference') then 'currentlyreading' elif $#readinglist=='To Be Read' && $$#percentread ==#0 then 'toberead' elif $$#percentread >=#100 then 'read' elif $$#percentread == 'None' then 'undefined' elif $$#percentread >=#0 then 'unread' fi Last edited by ownedbycats; 04-16-2023 at 04:01 PM. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,440
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Here are the comments on the virtual_libraries_for_books() calibre database method that you must be using directly or indirectly:
Code:
# We get here if resolving the books in a VL triggers another VL # cache calculation. This can be 'real' recursion, for example a # VL expression using a template that calls virtual_libraries(), # or a search using a location of 'all' that causes evaluation # of a composite that uses virtual_libraries(). The first case # is an error and the exception message should appear somewhere. # However, the error can seem nondeterministic. It might not be # raised if the use is via a composite and that composite is # evaluated before it is used in the search. The second case is # also an error but if the composite isn't used in a VL then the # eventual answer will be correct because get_metadata() will # clear the caches. A 'fix' might be to call virtual_libraries() in the column evaluation instead of referencing the composite column containing the call to virtual_libraries(). This would remove order of evaluation concerns. But TBH I can't say without having access to all the composites and VLs you have set up. I'm sure that the complexity of the your setup will make things very hard to understand. Another fix might be to never use naked searches. The "real" fix requires computing a graph of accesses then evaluating the nodes in graph order. This isn't going to happen. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,952
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I looked through my composite columns for any reference to virtual_libraries().
I found one in the composite I use to generate part of an SFM save template, but I don't think it's referenced anywhere else (except the save template obviously). I changed it to use a non-VL check instead. (Actually, that reminds me of something. I'll ask in the template questions thread.) I also ran through my Cleanup saved searches as I use them for my 'Cleanup' VL. Nothing checking virtual libaries there. There's a few virtual_libraries() references in my column icons. I don't think there's any relation there especially since I don't think it's possible to reference the icons elsewhere. Another thought: I do have a custom column for displaying the read status in the tag browser and book details. I wonder if making the VL reference that instead would change anything. Code:
program: if readstatus()=='currentlyreading' then 'Currently Reading' elif readstatus()=='toberead' then 'To Be Read' elif readstatus()=='read' then 'Read' elif readstatus()=='unread' then 'Unread' elif readstatus()=='undefined' then '' fi Last edited by ownedbycats; 04-16-2023 at 05:28 PM. |
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,440
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
The source for the readstatus() stored template doesn't seem to reference composites. How could it be changed to use virtual_libraries()? FWIW: In the program above, you should call readstatus() once, save the result to a variable, then check that variable. Calling it on every if branch will be much slower. |
|
![]() |
![]() |
![]() |
#5 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,952
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Yes, I have a #vls column. I looked for references to that too but didn't see any.
No naked searches, I don't think. I use limited searches anyways and only on non-composites. All my VL searches use either exact or regex searches: - Several have an exact search on non-composite #booktype. - Two have format:whatever (for physical and loaned books) - Two other (purchases and series) have fieldname:true. Series also has a regex to exclude several entries from #booktype. - Cleanup is based on a nested saved search (it references a bunch of smaller saved searches). I looked through the searches and found no references to composite columns or virtual_libraries() and no naked searches. readstatus() only calls two non-composite columns. The VL searches then call readstatus(). Last edited by ownedbycats; 04-16-2023 at 05:54 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,440
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
To help, run in debug mode. If you have disabled exception tracing in the formatter with the hidden tweak, reenable it. When it happens again note the exact error message and post the exception trace from the debug log. |
|
![]() |
![]() |
![]() |
#7 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,952
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I'll try that -- it sometimes happens on startup. But since it's spordaic it might take a while
![]() |
![]() |
![]() |
![]() |
#8 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,440
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Content server- Virtual library list: 1 line by library | huotg01 | Server | 10 | 03-21-2023 08:44 PM |
Virtual Libraries - Using Multiple searches to make one virtual library | tlwright | Library Management | 3 | 07-23-2020 06:29 PM |
Returning to Full Library from Virtual Library | The Texas Dude | Library Management | 11 | 02-19-2017 08:32 PM |
Virtual Library | Infinite3 | Library Management | 2 | 03-31-2015 06:19 PM |
Virtual Library still show up in main library | bskies | Library Management | 3 | 11-13-2013 10:41 PM |