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

Refresh button should clear HTTP cache #11485

Closed
GregoryTravis opened this issue Nov 4, 2024 · 7 comments · Fixed by #11577
Closed

Refresh button should clear HTTP cache #11485

GregoryTravis opened this issue Nov 4, 2024 · 7 comments · Fixed by #11577
Assignees
Labels
-compiler -libs Libraries: New libraries to be implemented p-low Low priority

Comments

@GregoryTravis
Copy link
Contributor

GregoryTravis commented Nov 4, 2024

We need to connect refresh to the std-bits EnsoHTTPResponseCache.clear() in some way.
Options:

  • Create a dependency between the language server and std-bits
  • Register the cache (or the clear method) on library load (preferred)
@GregoryTravis GregoryTravis added p-low Low priority -libs Libraries: New libraries to be implemented labels Nov 4, 2024
@GregoryTravis GregoryTravis self-assigned this Nov 4, 2024
@github-project-automation github-project-automation bot moved this to ❓New in Issues Board Nov 4, 2024
@hubertp
Copy link
Collaborator

hubertp commented Nov 13, 2024

Plan is to

  • extend libraries' package.yaml with an additional "hooks" section:
hooks:
  refresh:
    - <FQN of method to call>
    - Standard.Base.HTTP.Caches.refresh
  • ability for LS to parse the new config
  • ability for LS to call arbitrary expression
  • call a list of refresh hooks on RecomputeContextRequest
  • expose Java method in (private) Enso API so that it can be expressed via FQN

@4e6
Copy link
Contributor

4e6 commented Nov 13, 2024

Maybe we can call the main section scripts instead of hooks. Because this feature looks similar to scripting support in other programs, where users can implement their own code snippets that will be executed at certain conditions.

@hubertp
Copy link
Collaborator

hubertp commented Nov 14, 2024

scripts it is then. Config part is done. Over to you @4e6

@GregoryTravis
Copy link
Contributor Author

This is #11555

@JaroslavTulach
Copy link
Member

JaroslavTulach commented Nov 15, 2024

As an outsider to the face to face discussions I can only imagine what are the actual use-cases. The only one I see is:

We need to connect refresh to the std-bits EnsoHTTPResponseCache.clear() in some way.

and then I see a plan:

Plan is to
* [ ] extend libraries' package.yaml with an additional "hooks" section:

I don't see why the plan would be the best way to implement the above use-case? In my opinion, the following API would be sufficient, smaller, less cross-cutting change and possibly even more general way of controlled caching also satisfying the above use-case:

diff --git distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/Ref.enso distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/Ref.enso
index 8e8edcde12..9265fb9fb0 100644
--- distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/Ref.enso
+++ distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/Ref.enso
@@ -8,16 +8,29 @@ type Ref
     ## PRIVATE
        ADVANCED
        Creates a new reference containing the provided value.
+       If `can_disappear` is set to `True` than the management
+       of the reference is controlled by the runtime which
+       may _set the reference to `Nothing` any time_. The
+       definition of _"any time"_ is intentionally vague, but
+       the known implementations reset the value when running
+       out of memory or when a user asks for _"clean re-execution"_
+       of a project.
 
        Arguments:
        - value: The value to be contained in the ref.
+       - can_disappear: Is the value eligible for being cleared by the system at any time?
 
        > Example
          Creating a new reference containing the value 7.
 
              Ref.new 7
+
+       > Example
+         Cache a value, but allow the system to reclaim it.
+
+             Ref.new huge_data_downloaded_from_internet True
     new : Any -> Ref
-    new value = @Builtin_Method "Ref.new"
+    new value can_disappear=False = @Builtin_Method "Ref.new"
 
     ## GROUP Metadata
        ICON metadata

Of course, being an outsider, I cannot really know what other use-cases were discussed that lead to the selection of the current plan. Maybe my proposal doesn't address one of such discussed use-cases. However I cannot know unless the use-cases are summarized and written down.

@enso-bot
Copy link

enso-bot bot commented Dec 3, 2024

Jaroslav Tulach reports a new STANDUP for yesterday (2024-12-02):

Progress: .

GitHub
Advent of Code 2024 in Enso. Contribute to JaroslavTulach/AOC-2024-Enso development by creating an account on GitHub.

@JaroslavTulach JaroslavTulach moved this from 🔧 Implementation to 👁️ Code review in Issues Board Dec 3, 2024
@github-project-automation github-project-automation bot moved this from 👁️ Code review to 🟢 Accepted in Issues Board Dec 3, 2024
@enso-bot
Copy link

enso-bot bot commented Dec 4, 2024

Jaroslav Tulach reports a new STANDUP for yesterday (2024-12-03):

Progress: .

Discord
Discord is great for playing games and chilling with friends, or even building a worldwide community. Customize your own space to talk, play, and hang out.

@GregoryTravis GregoryTravis reopened this Dec 10, 2024
@github-project-automation github-project-automation bot moved this from 🟢 Accepted to ❓New in Issues Board Dec 10, 2024
@github-project-automation github-project-automation bot moved this from ❓New to 🟢 Accepted in Issues Board Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-compiler -libs Libraries: New libraries to be implemented p-low Low priority
Projects
Status: 🟢 Accepted
Development

Successfully merging a pull request may close this issue.

4 participants