Skip to content

Commit f6fbd28

Browse files
committed
Enable cache to work with a single resource
And an empty parent Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent d618737 commit f6fbd28

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/commoncode/resource.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,20 +604,24 @@ def _use_disk_cache_for_resource(self, rid):
604604
msg = [' Codebase._use_disk_cache_for_resource:, rid:', rid, 'mode:']
605605
if rid == 0:
606606
msg.append('root')
607+
elif rid is None:
608+
msg.append('from memory')
607609
elif self.all_on_disk:
608610
msg.append('all_on_disk')
609611
elif self.all_in_memory:
610612
msg.append('all_in_memory')
611613
else:
612614
msg.extend(['mixed:', 'self.max_in_memory:', self.max_in_memory])
613-
if rid < self.max_in_memory:
615+
if rid and rid < self.max_in_memory:
614616
msg.append('from memory')
615617
else:
616618
msg.append('from disk')
617619
logger_debug(*msg)
618620

619621
if rid == 0:
620622
return False
623+
elif rid is None:
624+
return False
621625
elif self.all_on_disk:
622626
return True
623627
elif self.all_in_memory:

0 commit comments

Comments
 (0)