A thread I spawned is consuming resources, and I’d like to stop it, but I don’t have a reference to it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns services.jwt | |
(:require [buddy.sign.jwt :as jwt] | |
[clojure.data.codec.base64 :as b64] | |
[clojure.string :as str] | |
[cheshire.core :as json] | |
[buddy.core.keys :as keys] ;; You need to use [buddy/buddy-core "1.5.0-SNAPSHOT"] | |
[clojure.java.io :as io])) | |
(defn decode-b64 [str] (String. (b64/decode (.getBytes str)))) | |
(defn parse-json [s] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn re-extract | |
"Try to re-find all given regexps until one matches. | |
nil if none matches." | |
[value & regexps] | |
(cond | |
(nil? value) nil ;; safe fallback | |
(empty? regexps) nil ;; no params or no more regexps to try | |
:else (let [pattern (first regexps) ;; take the first one | |
extracted (re-find pattern value)] ;; search for it |