getSortedRequests returns a sorted copy of requests based on the checker type. This method creates a copy of the requests to avoid modifying the original collection and sorts them according to the BulkCheckerType (entity ID or subject ID). The sorting ensures consistent and predictable result orderi
()
| 215 | // collection and sorts them according to the BulkCheckerType (entity ID or subject ID). |
| 216 | // The sorting ensures consistent and predictable result ordering. |
| 217 | func (bc *BulkChecker) getSortedRequests() []BulkCheckerRequest { |
| 218 | bc.requestsMu.RLock() |
| 219 | defer bc.requestsMu.RUnlock() |
| 220 | |
| 221 | // Create a copy to avoid modifying the original |
| 222 | requests := make([]BulkCheckerRequest, len(bc.requests)) |
| 223 | copy(requests, bc.requests) |
| 224 | |
| 225 | // Sort the copy based on the checker type |
| 226 | bc.sortRequests(requests) |
| 227 | return requests |
| 228 | } |
| 229 | |
| 230 | // sortRequests sorts requests based on the checker type. |
| 231 | // This method implements different sorting strategies: |