I can see this being the case. Nominally, my component looks like this.
Before I log a bug however, let's see first, if anyone is seeing this
behaviour.
(ns a
(:require [com.stuartsierra.component :as component]
[taoensso.timbre :as timbre]))
(defrecord A [env]
component/Lifecycle
(start [component]
(assoc component :a (atom {*...*})))
(stop [component]
(dissoc component :a)))
(defn component-a [env]
(map->A {:env env}))
Tim Washington
Interruptsoftware.com <http://interruptsoftware.com>
On Fri, May 9, 2014 at 6:40 PM, James Reeves <[email protected]> wrote:
> If you only created the atom once, the value of the atom would be the same
> no matter where you dereferenced it. If you're seeing two different atoms,
> then the code that created the atom must have been executed more than once.
>
> Without seeing your code it's impossible to know for sure how that
> occurred. There's nothing obvious in the pseudocode you presented that
> would indicate where the atom is being created more than once.
>
> - James
>
>
> On 9 May 2014 22:49, Timothy Washington <[email protected]> wrote:
>
>> Sorry, just reading this now.
>>
>> I've pivoted on that project, and that code is no longer around. We were
>> going to store analytics data in that atom, but instead are going to do JVM
>> and other kinds of profiling.
>>
>> But if you look at my first message, component *:a* would have had the
>> atom. The *:updater* and *:reader* components were referencing that.
>> Now, if there's any duplication like what you describe, it would have to
>> come where I set up the component system/map. But my code's perspective, I
>> only created that atom once. Sorry I don't have immediate access to that
>> code. I can't show it to you either. But if need be, I can go back in git
>> history, and troubleshoot the codebase as it was on April 30th. But again,
>> my description abouve fairly captures the situation.
>>
>>
>> Lemme know
>>
>> Tim Washington
>> Interruptsoftware.com <http://interruptsoftware.com>
>>
>>
>> On Wed, May 7, 2014 at 1:31 PM, Stuart Sierra <
>> [email protected]> wrote:
>>
>>> Actually, now that I think about it, that's not right. It shouldn't
>>> matter where or when you create the Atom.
>>>
>>> Instead, what I suspect you have is two or more instances of the
>>> component containing the Atom, thus two different Atoms.
>>>
>>> You can tell if the Atoms are the same object by printing them, which
>>> shows a unique hash of each Atom's identity.
>>>
>>> -S
>>>
>>>
>>>
>>> On Monday, May 5, 2014 6:25:55 PM UTC-4, frye wrote:
>>>
>>>> Ahh, so that was it then. Yeah, I definitely created that atom in the
>>>> start method.
>>>>
>>>>
>>>> On Mon, May 5, 2014 at 3:27 PM, Stuart Sierra <
>>>> [email protected]> wrote:
>>>>
>>>>> At what point did you **create** the Atom in :a? Any mutable
>>>>> references which need to be shared among all usages of a component must be
>>>>> created in the **constructor**, not the `start` or `stop` methods.
>>>>>
>>>>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.