John Mulcahy
REW Author
Thread Starter
- Joined
- Apr 3, 2017
- Posts
- 7,996
Looks like three problems to me:
- You are going through the list in numeric order, but each time a measurement is deleted the list gets shorter so you may end up trying to delete indices that are no longer where they were or no longer present at all
- 10ms is quite a short timeout for a measurement deletion to complete, so you are probably sending deletion requests before the previous request has completed. I'll make the API reject requests while one is already in progress.
- You don't appear to be looking at the API responses. If the response isn't a 200 (OK) you need to decide what to do about it. Some API commands return a 202 (Accepted), meaning what you have asked for is being worked on and you either need to wait for it to complete or register a webhook url to be notified when it has completed. If a 400 (Bad request) is returned you need to look at the message to understand why the API isn't happy with what you asked it to do. The measurements service will return a 404 (Not found) if you try and do something with a measurement index that doesn't exist, likely because you have already shortened the list by deletions so the index is now past the end.