Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to retrieve cache from key which doesn't exist yet triggers fatal error #190

Open
GigaDroid opened this issue Nov 29, 2024 · 4 comments

Comments

@GigaDroid
Copy link

GigaDroid commented Nov 29, 2024

Hey,

Currently, when attempting to retrieve a value from the cache using a key that doesn't exist, an exception is triggered, halting the workflow. While I understand the rationale behind this design, it's causing a blocker for my use case. Let me explain my workflow:

  • Attempt to retrieve a value from the cache using a key that might or might not exist.
  • Check if the result is empty or not.
  • If the cache doesn't contain a value for that key, execute additional nodes.
  • Save the result back to the cache.

Unfortunately, this process fails at the first step due to the exception. To address this issue, here are two potential solutions:

  • Modify the behavior so that if a key does not exist, the retrieval returns null instead of throwing an exception.
  • Introduce a new node that checks whether a key exists in the cache.
    Either of these solutions would enable my workflow without disrupting current functionality. I’d love to hear your thoughts on this or explore alternative approaches if you have other suggestions.
@ltdrdata
Copy link
Owner

ltdrdata commented Nov 29, 2024

In my opinion, blocking when the cache does not exist seems like the better approach.

Previously, this wasn’t feasible, so I left it as it was, but now with the latest ExecutionBlock, blocking in the absence of the cache feels more seamless.

@GigaDroid
Copy link
Author

Yeah maybe... I'm not that experienced with ComfyUI yet, I'm not 100% sure if blocking would solve the problem in the use case mentioned above. Just want to make it clear that my end goal here to have a way of skipping certain compute steps if the data is already in cache and do the compute and save it if it's not. My thought was to have a switch which would check if the data is null or not and based on that run some other nodes. Not sure if that would be possible with ExecutionBlock

@ltdrdata
Copy link
Owner

ltdrdata commented Nov 30, 2024

Yeah maybe... I'm not that experienced with ComfyUI yet, I'm not 100% sure if blocking would solve the problem in the use case mentioned above. Just want to make it clear that my end goal here to have a way of skipping certain compute steps if the data is already in cache and do the compute and save it if it's not. My thought was to have a switch which would check if the data is null or not and based on that run some other nodes. Not sure if that would be possible with ExecutionBlock

It seems that in your case, the Is Cached node is needed.
image

@GigaDroid
Copy link
Author

Yeah that something I would need, awesome thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants