Skip to main content

My Addin works under the development environment but when installed to a database will go over the rate limits

AshleyFC-1448
Original Poster

As per the subject.

 

I scaffolded the add-in using the generator-addin, I did add the Zenith React system and have been able to get the add-in to work under the dev environment it provided, but when I add the configuration to a database, the requests just ramp up like my add-in is being refreshed or some state I'm depending on is being reset and triggering fetching all the data again.

 

When testing, it will back about 150ish requests, but live it will cascade to 2000+ and hit the rate limits. I had added some fallback to delay requests if it hit a specific number, but it doesn't appear to work live.

 

The app flow is to get all database devices and check if they have the Iridium feature. Get the last stop date, and search over the last debug record of the IMEI number and Poll dates.

 

I've made a similar add-in for submitting engine data for Custom Devices, but it didn't use React.

 

Happy to share what I can of the source code

 

Join the conversation

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

Top Answers

AshleyFC-1448
Original Poster

I found the issue. My CustomHook was attempting to do to much, fetch the initial data from Groups and Active Asset, track the current table page if more than 50 and then update the arrays to paginate through the list. Split these into two Effects one that set the the state for all data and another to update the paginated list.

4 Replies

Hello @AshleyFC-1448​ 

 

Thank you for your contribution. I'm interested in knowing the purpose of your add-on.

Could you provide me with more information?

 

AshleyFC-1448
Original Poster

The add-in creates a table that displays the last found IMEI number for the connected IOX-SATIRIDv2 as well as the last poll from that Iridium via the debug data. This is based on the assets last trip date back 7 days. It will only pull 1 found record against each debug record type. Over 50 units it can be about 130-150 request each page on large databases.

 

I believe I'm having an issue with when the add-in focus function is mounting the React DOM and it keeps attempting to redraw and restart while on the page when I installer it into a database.

 

Doesn't occur in the dev environment.

AshleyFC-1448
Original Poster

I believe the issue is in how I'm getting and transforming the data so it can be displayed into the Table component, while it "works" in the dev environment I believe I'm ignoring several rules when using useEffect and useCallback to attempt to get the data to work as expected. When I build the add-in for live deployment Webpack and Babel "fit" the dependencies I'm not including, causing the UI to be redrawn.

 

I think need to work on separating out some of the data call and transforming logic.

Unsure how yet but I believe I'm close to a possible solution to this re-rendering issue.

 

It would be nice to have some better live examples of add-ins that use React or Zenith available

AshleyFC-1448
Original Poster

I found the issue. My CustomHook was attempting to do to much, fetch the initial data from Groups and Active Asset, track the current table page if more than 50 and then update the arrays to paginate through the list. Split these into two Effects one that set the the state for all data and another to update the paginated list.

Still have questions?