GetStream / stream-net

NET Client - Build Activity Feeds & Streams with GetStream.io

Home Page:https://getstream.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Batch Read Activities By ForeignIdTimes does not return activities that actually exist

sinapy opened this issue · comments

commented

I'm using .net 6, and the stream-net client to connect with getstream.

When I add an activity to a feed, I use the foreignIdTime approach. So I add a foreignId as string, and a dateTime.

However, when I create an activity, and then use the batch read by foreignIdTime (_streamClient.Batch.GetActivitiesByForeignIdAsync(foreignIdTimesList);), it does not return the created activity even though, the activity was created with the same foreignId and time

example code

public async Task<bool> CheckPostExistsInGetstream(int? postId, DateTime? createdDate)
        {
            // postId = 27410
            // createdDate =  {8/31/2023 4:55:46 AM}
            if (createdDate == null)
            {
                return false;
            }

            ForeignIdTime foreignIdTime = new($"post:{postId}", createdDate.Value);

            GenericGetResponse<Activity> recievedActivitiesResponse = await _streamClient.Batch.GetActivitiesByForeignIdAsync(new[] { foreignIdTime });

            if (recievedActivitiesResponse.Results.Count > 0) 
            {
                return true;
            }

            return false;
        }

The above code for the PostId = 27410 and createdDate = {8/31/2023 4:55:46 AM} returns false

and as you can see the activity does exist.
image

Hello and thanks for submitting an issue to our GitHub repository. We’re glad you’re getting hands on with the product. The Issue section of this Github repo is now reserved only for bug reports and feature improvements and suggestions. It looks like what you’re looking for is technical support using the product. For this support, we kindly ask you to submit a support request through our help center at https://getstream.io/contact/support/ with your application key or ID and we’ll be able to help you out. Thanks for your understanding, we’re going to mark this issue as closed.

In case our understanding is incorrect and you are describing a bug, we apologise, and invite you to please follow up with a minimal reproduction of the bug and we will reopen the issue and investigate accordingly.

commented

Hi @JimmyPettersson85 , what I commented earlier is a description of a bug

To reproduce this issue

  1. create an activity in getstream using foreignIdTime
  2. Use await _streamClient.Batch.GetActivitiesByForeignIdAsync(new[] { foreignIdTime }); to try to get that activity
  3. You won't see the post you created in the result of step 2 (this is the bug, it should show up but it's not showing)