Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes scheduler reminders app #241

Merged
merged 11 commits into from
Nov 26, 2024

Conversation

elena-kolevska
Copy link
Contributor

Addresses: #240

Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
@elena-kolevska elena-kolevska marked this pull request as draft November 26, 2024 00:03
@elena-kolevska elena-kolevska marked this pull request as ready for review November 26, 2024 01:25
Signed-off-by: Elena Kolevska <[email protected]>
Co-authored-by: Cassie Coyle <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
if err != nil {
log.Printf("error unmarshaling player state: %v", err)
if playerResp == nil {
log.Printf("Can't get player health.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be fatal?

Otherwise this will just return the go routine that is doing the bulk of this test anyways.

Suggested change
log.Printf("Can't get player health.")
log.Fatalf("Can't get player health.")

Copy link
Contributor Author

@elena-kolevska elena-kolevska Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think I should have just added a return in the err check above. That way, if there's a network error we'll just ignore that and retry in 5seconds. I'll do that now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine by me

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this will still cause the go routine to exit and not test what we want for the longhaul unless Im mistaken. Sure the app wont panic now. I think this still should fatalf on the get user bc then that negatively impacts the reminder calls for the actor? Similar to the other comment on another fatalf call.

// if they don't, the app is not testing what we need to test and we need to exit
		log.Fatalf("failed to start health decay reminder: %w", err)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sorry, that was supposed to be a continue, not a return. But anyway, I think we should decide if we're going to panic on all errors on calls to dapr, or not. My thinking was to fail on the initial ones that are a condition for the others to even be able to run, but I also see the value in failing on all, because that way we'll see in the dashboard that something's wrong.
So what do you think, should we update all of them to panic()?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not panic unless you are simulating a crash in the app.

invokeCtx, invokeCancel := context.WithTimeout(ctx, 5*time.Second)
resp, err := client.InvokeActor(invokeCtx, req)
invokeCancel()
playerResp, err := actor.GetUser(ctx)
if err != nil {
log.Printf("error invoking actor method GetUser: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.Printf("error invoking actor method GetUser: %v", err)
log.Fatalf("error invoking actor method GetUser: %v", err)

Signed-off-by: Elena Kolevska <[email protected]>
@artursouza artursouza merged commit 561ea0c into dapr:master Nov 26, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants