Skip to content

[CS1998] This async method lacks 'await' operators and will run synchronously #6513

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

Merged
merged 6 commits into from
Mar 15, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/core/Akka.Persistence/Journal/MemoryJournal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ protected override bool ReceivePluginInternal(object message)

private async Task<(IEnumerable<string> Ids, int LastOrdering)> SelectAllPersistenceIdsAsync(int offset)
{
return (new HashSet<string>(_allMessages.Skip(offset).Select(p => p.PersistenceId)), _allMessages.Count);
return await Task.FromResult((new HashSet<string>(_allMessages.Skip(offset).Select(p => p.PersistenceId)), _allMessages.Count));
Copy link
Contributor Author

@eaba eaba Mar 13, 2023

Choose a reason for hiding this comment

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

Let's talk about this @Aaronontheweb @Arkatufus

image

Copy link
Member

Choose a reason for hiding this comment

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

I'd remove the async and the await here - just returning the Task.Result should be fine.

//return (new HashSet<string>(_allMessages.Skip(offset).Select(p => p.PersistenceId)), _allMessages.Count);
}

/// <summary>
Expand All @@ -207,7 +208,8 @@ private async Task<int> ReplayTaggedMessagesAsync(ReplayTaggedMessages replay)
index++;
}

return _tagsToMessagesMapping[replay.Tag].Count - 1;
return await Task.FromResult(_tagsToMessagesMapping[replay.Tag].Count - 1);
Copy link
Contributor Author

@eaba eaba Mar 13, 2023

Choose a reason for hiding this comment

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

Let's talk about this @Aaronontheweb @Arkatufus

image

Copy link
Member

Choose a reason for hiding this comment

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

Same feedback as above.

//return _tagsToMessagesMapping[replay.Tag].Count - 1;
}

private async Task<int> ReplayAllEventsAsync(ReplayAllEvents replay)
Expand All @@ -222,8 +224,8 @@ private async Task<int> ReplayAllEventsAsync(ReplayAllEvents replay)
replay.ReplyTo.Tell(new ReplayedEvent(message, replay.FromOffset + index), ActorRefs.NoSender);
index++;
}

return _allMessages.Count - 1;
return await Task.FromResult(_allMessages.Count - 1);
//return _allMessages.Count - 1;
}

#region QueryAPI
Expand Down Expand Up @@ -439,7 +441,6 @@ public sealed class ReplayedEvent : INoSerializationVerificationNeeded, IDeadLet
/// TBD
/// </summary>
/// <param name="persistent">TBD</param>
/// <param name="tag">TBD</param>
/// <param name="offset">TBD</param>
public ReplayedEvent(IPersistentRepresentation persistent, int offset)
{
Expand Down