These are chat archives for exceptionless/Discuss

10th
Nov 2015
Eric J. Smith
@ejsmith
Nov 10 2015 17:36
yo blake
Blake Niemyjski
@niemyjski
Nov 10 2015 17:36
yo
Eric J. Smith
@ejsmith
Nov 10 2015 17:36
I had an idea for our repos.
Blake Niemyjski
@niemyjski
Nov 10 2015 17:37
yeah?
Eric J. Smith
@ejsmith
Nov 10 2015 17:37
right now on the Save method we are doing a lookup to get the original entity.
Blake Niemyjski
@niemyjski
Nov 10 2015 17:37
yeah cause we don't know what properties changed
and we need to invalidate the cache on those
Eric J. Smith
@ejsmith
Nov 10 2015 17:38
maybe we should start storing the originals in an in memory cache client when we fetch them.
get rid of all those lookups that are happening on save.
Blake Niemyjski
@niemyjski
Nov 10 2015 17:38
already have that for the hybrid cache client
Eric J. Smith
@ejsmith
Nov 10 2015 17:38
yeah, not sure if we would mix this into that or not.
Blake Niemyjski
@niemyjski
Nov 10 2015 17:39
well if you don't you will have more memory usage
and those updates don't happen often
would be nice to save a potential look up
too bad we don't have dirty tracking
but that would add alot of overhead
Eric J. Smith
@ejsmith
Nov 10 2015 17:50
oops… sorry… someone stopped by
yeah, anything that doesn’t require you to modify your model for dirty checking just stores the fetched entity like this.
and then compares.
Blake Niemyjski
@niemyjski
Nov 10 2015 18:11
Yeah
But what's more expensive getting from cache and comparing or getting from cache/repo
Eric J. Smith
@ejsmith
Nov 10 2015 18:26
Getting from repo is more expensive for sure.
Blake Niemyjski
@niemyjski
Nov 10 2015 19:14
@ejsmith
for repositories should we be creating a new protected virtual method to create the Entity Changed messages?
protected virtual NewEntityChanged<T>() where T: EntityChanged?
or we could just override publish message and do a conversion from one entity changed type to the other or type cast
eh that won’t work for casting but could create a constructor
Blake Niemyjski
@niemyjski
Nov 10 2015 19:22
ah I found a better solution
hehe
Blake Niemyjski
@niemyjski
Nov 10 2015 19:40
I refacted everything to go into the ChangeType publish method but overriding that is a lot more work
almost be better if we did it on the generic publish message.
downside to that is we are doing it for every message
but those checks are cheap
Eric J. Smith
@ejsmith
Nov 10 2015 19:43
went to lunch...
Blake Niemyjski
@niemyjski
Nov 10 2015 19:43
ok
Eric J. Smith
@ejsmith
Nov 10 2015 19:44
yeah, I would like to figure out a better way to publish messages.
Blake Niemyjski
@niemyjski
Nov 10 2015 19:44
yeah
Eric J. Smith
@ejsmith
Nov 10 2015 19:44
like maybe I want to publish some other message completely vs the entitychanged.
Blake Niemyjski
@niemyjski
Nov 10 2015 19:44
I don’t like how we have it now
yeah
Eric J. Smith
@ejsmith
Nov 10 2015 19:45
so I was thinking about the change tracking… I guess we could have an interface for doing change tracking.
people could decide if they wanted to implement that or not.
but that wouldn’t give us access to the original entity.
Blake Niemyjski
@niemyjski
Nov 10 2015 19:45
double the memory for every change no?
Eric J. Smith
@ejsmith
Nov 10 2015 19:46
huh?
a lot of the entities when we fetch them we are caching them anyway.
yeah, I’m not sure.
Blake Niemyjski
@niemyjski
Nov 10 2015 19:46
we could just make the assumption that if you are caching by a property.. that property has to be immutable
Eric J. Smith
@ejsmith
Nov 10 2015 19:46
maybe what we are doing is the best we are going to do.
but it sucks to have to fetch them all the time.
Blake Niemyjski
@niemyjski
Nov 10 2015 19:47
yup
Eric J. Smith
@ejsmith
Nov 10 2015 19:53
if we had an interface that entities could implement to do dirty tracking then we would know if we needed to save the entity or if we needed to fetch the original.
not sure if that helps much since I’m not sure how many times you would be calling save without having modified the entity.
Blake Niemyjski
@niemyjski
Nov 10 2015 19:53
or we could do a cache exists hit and lookup..
Eric J. Smith
@ejsmith
Nov 10 2015 19:54
we do
Blake Niemyjski
@niemyjski
Nov 10 2015 20:25
We have SendNotificationsAsync and PublishNotificationsAsync
EnableNotifications and BatchNotifications properties
seems like this stuff can be simplified greatly
Eric J. Smith
@ejsmith
Nov 10 2015 20:27
yeah, somehow… have thought about it a little bit.
Blake Niemyjski
@niemyjski
Nov 10 2015 20:32
yeah
looking at it now
looks like our batch notifications was never working as designed
we have a flag we check.. which calls publish message passing it a collection that collection sends out a message per document (which isn’t in batch)
Eric J. Smith
@ejsmith
Nov 10 2015 20:34
thats not true
it works
Blake Niemyjski
@niemyjski
Nov 10 2015 20:50
exceptionless/Foundatio@5112f78
look at the code
called the publish message overload
and it did a foreach
so yeah wasn’t batching
awesome news
Eric J. Smith
@ejsmith
Nov 10 2015 21:05
Guarantee it works because we aren't getting crazy amounts of notifications on batches of saves.
Blake Niemyjski
@niemyjski
Nov 10 2015 21:06
well look at the code
it doesn’t lie
we were doing a modifieddocuments.select(d => d.value) which calls the second publish message overload which does a foreach
Eric J. Smith
@ejsmith
Nov 10 2015 21:16
so I have observed 1st hand a few days ago that it batched the messages… guess that doesn’t matter, eh?
Blake Niemyjski
@niemyjski
Nov 10 2015 21:16
I followed the code
and that’s concrete
Eric J. Smith
@ejsmith
Nov 10 2015 21:17
lol ok
Blake Niemyjski
@niemyjski
Nov 10 2015 21:17
Sure you had multiple documents when you stepped through it
?
Blake Niemyjski
@niemyjski
Nov 10 2015 22:04
can you just post a doc and it automatically creates the dif set or do you have to detail each operation in json
like update property
Eric J. Smith
@ejsmith
Nov 10 2015 22:05
jsonpatch is a list of operations to perform.
there are client side libraries that generate a patch though.
so you make a change and then generate a patch based on the original.
Blake Niemyjski
@niemyjski
Nov 10 2015 22:06
yeah
the way we do it now is we just repost the modified document and the delta figures out what changed
or properties that were modified
be nice to change if that’s in asp.net 5 native
Eric J. Smith
@ejsmith
Nov 10 2015 22:07
the delta allows you to post a partial doc… but it only works for top level items.
Blake Niemyjski
@niemyjski
Nov 10 2015 22:07
yeah
something like this would allow you to remove child collection items
Eric J. Smith
@ejsmith
Nov 10 2015 22:07
patch is a standard
yeah
but that seems pretty scary though.
because how do you know someone hasn’t modified it before you?
Blake Niemyjski
@niemyjski
Nov 10 2015 22:08
I like the json patch stuff. Just wonder how much of a pita is client side cause you can’t reliably tell what’s changed
and we don’t keep track of the original..
yeah
and how do you tell it what things shouldn’t be modified
ever