Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 18 21:49
    jeremydmiller closed #553
  • Oct 18 21:49

    jeremydmiller on master

    eliminating JasperGenerationRul… (compare)

  • Oct 18 21:30
    jeremydmiller closed #544
  • Oct 18 21:30

    jeremydmiller on master

    updated to Lamar extensions are applied in depen… (compare)

  • Oct 18 20:32

    jeremydmiller on master

    upgrading Marten support to the… updating DataFlow upgrading Baseline and 3 more (compare)

  • Oct 18 19:44
    jeremydmiller opened #553
  • Oct 18 19:41
    jeremydmiller edited #518
  • Oct 18 19:34
    jeremydmiller closed #540
  • Oct 18 19:34
    jeremydmiller commented #540
  • Oct 18 19:07
    jeremydmiller commented #552
  • Oct 18 18:53
    CodingGorilla commented #552
  • Oct 18 18:44
    jeremydmiller closed #552
  • Oct 18 18:44
    jeremydmiller commented #552
  • Oct 18 18:37

    jeremydmiller on master

    generalizing the code generatio… (compare)

  • Oct 16 21:40
    CodingGorilla opened #552
  • Oct 15 11:11
    jeremydmiller closed #538
  • Oct 15 11:11
    jeremydmiller commented #538
  • Oct 15 11:00
    jeremydmiller milestoned #414
  • Oct 15 11:00
    jeremydmiller milestoned #508
  • Oct 15 11:00
    jeremydmiller closed #499
Jeremy D. Miller
@jeremydmiller
Naw, to let codegen work even with the repository registration. So you just act for a repository, and the codegen handles it all for you.
Mark Warpool
@CodingGorilla
oh, right, that would be ideal =)
Mark Warpool
@CodingGorilla
ack... I can work around the issue with the factory, but it's ugly as hell, cuz I can't using IDisposable on the message handler, because that ends up getting called out of sync too, so I have to keep everything locally...
let me see if I can throw together a pull request for you
I know you've been busy at work lately :)
Jeremy D. Miller
@jeremydmiller
Yeah, not sure when that’s going to improve. It might be in the LamarCodeGeneration stuff. Needs to somehow do a look above in the frame tree to know if anything wraps it in a using block
I swear I’ve tried to deal with this before, but that would have been ~2 years ago and I’ve slept since then
Mark Warpool
@CodingGorilla
yea, looks like it's in LamarCodeGeneration
Mark Warpool
@CodingGorilla
So there seems to be a few different places where fixing this issue could be done, lamar's code gen seems to lean on the AsyncMode setting on the GeneratedMethod, but it also never seems to actually set that. So to make it "smarter" it would need to lean a little more on computing what the async mode should be.
So I'm happy to work on a PR for you, but I would need a little guidance from you on how to implement it. At which point, maybe you just would rather do it yourself.
Jeremy D. Miller
@jeremydmiller
It should be derived by looking through the Frames
Mark Warpool
@CodingGorilla
@jeremydmiller Ok, so after a lot of digging, and wracking my brains on how to successfully write a failing unit test for this, it looks like the fix is fairly simple. It looks like just changing the ServiceScopeFactoryCreation to set IsAsync to true would solve the problem, even though that is technically not true.
Also, it derives from SyncFrame, which always sets it to false, but doesn't provide anything else, so I'm not sure if there's some significance to making it a SyncFrame.
But in my hacky little test, making that simple change solves the problem
Jeremy D. Miller
@jeremydmiller
Ugh, that’s not quite right though. It’s possible to use that frame and not have any async. Is there a prop like IsWrapped or something liek that, so the actual method call from would know that there’s a reason to use async/await
?
Mark Warpool
@CodingGorilla
Oh, good point. Let me look into that
Mark Warpool
@CodingGorilla

Ok, so my thought is to add a new property to Frame: RequiresAwait, and then modify the MethodFrameArranger.Arange() as:

public void Arrange(out AsyncMode asyncMode, out Frame topFrame)
{
    var compiled = compileFrames(_method.Frames);

    asyncMode = AsyncMode.AsyncTask;

    if(compiled.Any(x => x.IsAsync) && compiled.Any(x => x.RequiresAwait))
    {
        asyncMode = AsyncMode.AsyncTask;
    }
    else if (compiled.All(x => !x.IsAsync))
    {
        asyncMode = AsyncMode.None;
    }
    else if (compiled.Count(x => x.IsAsync) == 1 && compiled.Last().IsAsync && compiled.Last().CanReturnTask())
    {
        asyncMode = compiled.Any(x => x.Wraps) ? AsyncMode.AsyncTask : AsyncMode.ReturnFromLastNode;
    }

    topFrame = chainFrames(compiled);
}

Thoughts?

Jeremy D. Miller
@jeremydmiller
I don’t think you need a new property on the frame. The IsAsync should be enough.
The case that screwed us is if ONLY the very last frame is IsAsync == true, but there’s another Frame somewhere that’s Wraps == true.
Mark Warpool
@CodingGorilla
well, if you want to just naively force an await on anything that is async, with this though, it would be "smarter"
Jeremy D. Miller
@jeremydmiller
I wonder if the Frame that wrote out the using statement was giving you the right Wraps value
It solves your problem fast. Returning the last task was just more optimal performance wise where you could get away with it
Mark Warpool
@CodingGorilla
what is Wraps indicative of?
Jeremy D. Miller
@jeremydmiller
That the frame does something that “wraps” the code in the following frames. So in the case of a using block, the prior Frame wraps code around the later frames
Mark Warpool
@CodingGorilla
The frame that caused the using was the ServiceScopeFactoryCreation, oh, and so yea it sounds like the ServiceScopeFactoryCreation should set Wraps to true, but it doesn't
So let me just change that quickly and see if that fixes the test
Jeremy D. Miller
@jeremydmiller
:thumbsup:
Mark Warpool
@CodingGorilla
HAHA, I spent like 12 hours on that, and it was a 3 second fix
Jeremy D. Miller
@jeremydmiller
Oh man, sorry about that. But it happens that way sometimes
Mark Warpool
@CodingGorilla
yea, no problem, it gave me a better understanding about how all the codegen works now :)
I'll submit a PR
Jeremy D. Miller
@jeremydmiller
Cool. Hoping things settle down for me next week so I can start processing OSS things again. Got at least a couple other things to do in both Jasper & Lamar
Jeremy D. Miller
@jeremydmiller
@CodingGorilla I think I’ll have a new Jasper release either tonight or tomorrow
Mark Warpool
@CodingGorilla
Great news, thanks! :+1:
Jeremy D. Miller
@jeremydmiller
It’s not huge, but there’s a Jasper v0.9.13 up today w/ some fixes for @CodingGorilla
Mark Warpool
@CodingGorilla
Thanks @jeremydmiller !
Stuart Clement
@jenart
Hey Guys, got a query regarding the correct/best practice for running Jasper within unit tests... I've put together a sample project on github to illustrate rather than trying to squeeze it all in here. Thanks in advance. Please see: [JasperTest] (https://github.com/jenart/JasperTest)
Mark Warpool
@CodingGorilla
@jeremydmiller I hate to bother you, but I have a major issue. I'm seeing an issue where Jasper seems to be running the handler for the same message twice concurrently.

In my debugging I end up seeing this:

Jasper.Messages:Information: Successfully processed message UpdateFeatureSubscriptions#016cbb46-b9f5-433d-86d0-23eaedc9e5e9 from loopback://retries/

in the output log, also, if I put a breakpoint at the top of the Handle method, that break point gets hit twice
Any thoughts on whether I might have something configured wrong that would cause this?
Mark Warpool
@CodingGorilla
Except maybe it only happens with the very first message it processes?
Jeremy D. Miller
@jeremydmiller
Can you try the diagnostic commands that spits out the handler code and see if that provides anything you don’t expect?
Can’t say that I’ve ever seen that
Mark Warpool
@CodingGorilla
No, seems totally normal, only one call to my handle method in the generated code
Jeremy D. Miller
@jeremydmiller
Ah, wait. It’s happening with retries? Seeing error messages too?
Mark Warpool
@CodingGorilla
it doesn't only do it on the first message, but it does seem to stop running the message handlers twice "after a while"
Jeremy D. Miller
@jeremydmiller
The presence of the retry queue makes me wonder a bit
Mark Warpool
@CodingGorilla
if I put enough break points, everything just !@#$ing works... :rage: