Conversation
darkleaf
commented
Mar 31, 2025
b548443 to
3289bae
Compare
darkleaf
commented
Apr 2, 2025
| @@ -0,0 +1,54 @@ | |||
| (ns darkleaf.di.tutorial.z-memoize-test ;;todo: name | |||
Owner
Author
There was a problem hiding this comment.
Тут предполагается написать тест-документацию.
А тест выше - технический.
Можно по идее технический тест сюда положить.
Collaborator
There was a problem hiding this comment.
лучше наш реальный юзкейс сюда
krevedkokun
requested changes
Apr 2, 2025
KGOH
reviewed
Apr 2, 2025
darkleaf
commented
Apr 2, 2025
darkleaf
commented
Apr 3, 2025
darkleaf
commented
Apr 3, 2025
src/darkleaf/di/core.clj
Outdated
| p/description | ||
| ;; хз надо ли так | ||
| ;; у нас тут нет способа понять уже закешировано или только сейчас | ||
| #_(assoc ::memoized true)))))))))) |
KGOH
reviewed
Apr 3, 2025
src/darkleaf/di/core.clj
Outdated
|
|
||
| (defn ->memoize | ||
| "Returns a statefull middleware that memoizes all registry build accesses. | ||
| Must be the last in a middleware chain. |
Collaborator
There was a problem hiding this comment.
memoizes all components before itself and doesn't affect the ones after it
Owner
Author
There was a problem hiding this comment.
Не согласуется с предыдущим предложением.
надо подумать.
fe5b8d1 to
7635db8
Compare
darkleaf
commented
Apr 3, 2025
darkleaf
commented
Apr 16, 2025
src/darkleaf/di/core.clj
Outdated
| (apply [_ previous-registry] | ||
| (when-not (-> previous-registry meta ::idx zero?) | ||
| (throw (ex-info "memoize should be first" {}))) | ||
| (let [registry (apply-middlewares previous-registry middlewares 0)] |
Owner
Author
There was a problem hiding this comment.
это будет вычисляться на каждый di/start, наверное это не является проблемой?
darkleaf
commented
Apr 16, 2025
| Function | ||
| (apply [_ previous-registry] | ||
| (when-not (-> previous-registry meta ::idx zero?) | ||
| (throw (ex-info "memoize should be first" {}))) |
darkleaf
commented
Apr 16, 2025
Comment on lines
115
to
103
| (-> (di/start `a mem) | ||
| (di/stop)) | ||
| (t/is (= [[:start ::param] | ||
| [:start `a] | ||
| [:start ::di/implicit-root]] | ||
| @log)))) |
Owner
Author
There was a problem hiding this comment.
может быть этот кусочек отдельным тестом?
тут проверяется, что .close на мапе вызывается
darkleaf
commented
Apr 16, 2025
darkleaf
commented
Apr 23, 2025
src/darkleaf/di/core.clj
Outdated
| (apply [_ previous-registry] | ||
| (when-not (-> previous-registry meta ::idx zero?) | ||
| (throw (ex-info "memoize should be first" {}))) | ||
| (let [registry (apply-middlewares previous-registry middlewares 0)] |
Owner
Author
There was a problem hiding this comment.
- это должно происходить уровнем выше. чтобы этого добиться нужно выпилить/переделать implicit-root. чтобы implicit-root не было в реестре, и чтобы цепочка реестров не зависила от ключа.
- это позволит делать проверку реестров по identical?
- нужно кэшировать фабрики, их инстанцирование занимает много времени
- функа в computeIfAbsent должна использовать ключ, а не замыкания
5876981 to
e5f602f
Compare
darkleaf
commented
Apr 25, 2025
| (when-not (identical? previous-registry initial-registry) | ||
| (throw (ex-info "memoize should be first" {}))) | ||
| (fn [key] | ||
| (let [factory #_(registry key) (.computeIfAbsent factories key registry)] |
darkleaf
commented
Apr 25, 2025
Comment on lines
+236
to
+237
| (concat (seq (p/dependencies factory)) | ||
| (seq {::side-dependency :optional}))) |
Owner
Author
|
closed by #54 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #36