Skip to main content

GetFeed call never reaches max version

mdevol
Original Poster

I'm going a GetFeed for DeviceStatusInfo, but it never returns a ToVersion value that >= to the max version.

Before I start looping, I made a call to get the max version which returned a value of 1378535. On the first call to GetFeed with fromVersion set to 0, it returned 7 DeviceStatusInfo records and a ToVersion of 1378497. On the next call to GetFeed with fromVersion set to 1378497, it returns 0 records and the same ToVersion value. At this point, I'm caught in an infinite loop because the ToVersion value is never >= the max version.

So, is this a known behavior where it's possible that max version may never be reached?

Also, this code runs against multiple GeoTab databases, but this issue only occurs against this one database.

If someone can provide an explanation, I would appreciate it.

Join the conversation

You need to be logged in to reply to this post and participate in the Geotab Community discussions.

3 Replies

EishiFUN
Community Administrator

Hey @mdevol ,

Thank you for asking your question in our community. I found some information from an AI tool about this but wasn't confident in the answer it gave. I want to check with our team to see before saying anything here. This is something maybe @TuckerBA-1087 or @LPPapillon-1145 has experience with they may be able to share some information about as well.

If they are busy or unable to help I will follow up as soon as I have confirmation from our team. Thank you for your patience while I look into it.

Have a good one!
Eishi FUN

I haven't seen this, but my hunch is that if you were to call again to get the max version, you'd get where you're at now. What call did you make exactly to get the max version? In general, with any GetFeed, the loop we use is if results.data is the same length as resultsLimit, then there are more to fetch. Loop until it's smaller. You should be wary of enforced resultsLimits though, if you use this logic with GetFeed on Device, but your code requests 50000 resultsLimit, the real limit is 5000, so a full page will return 5000. As long as you send resultsLimits equal or smaller than the actual enforced limits as per the documentation, this logic has been fool-proof for all entities across thousands of databases over several years.

+1 to this point. Is there a reason that you're looking for the max version specifically? If it's just to know when to stop asking for results, I would recommend exactly what @LPPapillon-1145suggests and simply loop until there are no more to get. For high-activity feeds, the version is likely to be a moving target anyway - you might find the current latest record and have additional records added by the time you're done looping and processing the first batch.

Still have questions?