#talker1284

1 messages · Page 1 of 1 (latest)

craggy nacelleBOT
noble hemlock
#

Hello 👋
I can't re-open but I am happy to help here if you catch me up on what issue you're having?

craggy nacelleBOT
kindred dust
#

@storm mural I'm stepping in for my teammate. Let me know if I can help!

storm mural
#

can you just reopen it so that we have context

#

this could be a bug in stirpe, else a bug in my code we were trying to figure that out.

kindred dust
#

No, I can't reopen. Please summarize your latest question here and I can continue to assist

storm mural
#

this is my c# code

    public async Task<IEnumerable<Subscription>> GetSubscriptionsByBatchNumber(int batchNo)
    {
        var subscriptions = new List<Subscription>();
        StripeSearchResult<Subscription> searchResult = null;

        do
        {
            var options = new SubscriptionSearchOptions()
            {
                Limit = 100,
                Query = $"metadata['BatchNo']:'{batchNo}'",
                Page = searchResult?.NextPage
            };

            searchResult = await _subscriptionRepository.SearchAsync(options);
            subscriptions.AddRange(searchResult.Data);

        } while (searchResult.HasMore);

        return subscriptions;
    }
#

returns 17

#

17 subscriptions

#

but when i set Limit to 5 its only returning 10

#

the other chat had the requestId's and such

#

req_Qt2HzcItkIxn9Z 1st request
req_Oj4t9yleZe8Z32 2nd request (returns id for NextPage, but when you goto the page there are no record in it adds nothing to the List and HasMore is false)

#

do you get what I am saying that i set limit to 5 and made those two requests above?

when request req_Oj4t9yleZe8Z32 fired, i had unexpected results.

#

ran it again,

  1. req_EpLJJt4djDus9h
  2. req_LQKWmHwHMgZqJs
  3. req_4JlzcTIG84zwzz (for the last request we expected 5 results returned and HasMore is true, what we got was 0 results returned and HasMore is false)
kindred dust
#

No, I'm not quite following. For requests # 2 and # 3 above, you're passing a value for page, in addition to the limit. Are you intending to do that?

storm mural
#

well yes, would this not be the next page number?

kindred dust
#

Let's take a step back. What are you trying to filter for exactly? Can you share more about your use case for searching for subscriptions (vs. storing subscription IDs in your database)?

storm mural
#

ok, so what is going on is we are trying to test paging. We are going to eventually have thousands of subscriptions in here and we need a mechanism to search for the subscrptions by batch number.

#

what we are testing is that if we change our limit to 5 we expect to be able to page through all the subscriptions. The descrepency I am having is that if i set Limit = 100 i get 17 records back. But if i set the limit to 5 to test our code which is iterating over the pages I am only getting a total of 10 records come back. I am trying to figure out why there is a discrpency here.

#

we will need this to return all of the subscriptions, the goal here is to test paging on a limited number of subscriptions.

kindred dust
#

We are going to eventually have thousands of subscriptions in here and we need a mechanism to search for the subscrptions by batch number.
I recommend avoiding the search endpoint altogether and instead keeping track of these subscription IDs and batch numbers in your database

storm mural
#

i will take note of that

#

I would keep everything in our own database if this was my call.