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

Add reset-executor! and shutdown-executor! to re-frame.interop #810

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lowecg
Copy link

@lowecg lowecg commented Nov 17, 2024

For #809

Executor Service Lifecycle Management
Added two functions to manage the executor service lifecycle in re-frame/interop:

reset-executor! - Creates a fresh single-threaded executor when needed
shutdown-executor! - Cleanly terminates the executor with configurable timeout

Why?
These functions enable proper cleanup in short-lived processes like AWS Lambda, CLI runs and tests. Without explicit shutdown, the non-daemon executor threads prevent the JVM from exiting cleanly.

Adding the following to a test ensures clean shutdown:

(ns my-ns
  (:require
    [clojure.test :refer :all]
    [re-frame.interop :as interop]
    ...))

(use-fixtures :once
              (fn [f]
                (f)  ; runs all tests
                (interop/shutdown-executor! 100)))

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

Successfully merging this pull request may close these issues.

1 participant