MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / process

Method process

aura/github.py:115–150  ·  view source on GitHub ↗
(self, max_retries=3, backoff=1.0)

Source from the content-addressed store, hash-verified

113 return 0.0
114
115 async def process(self, max_retries=3, backoff=1.0):
116 while True:
117 api_wait_time = self.wait_time
118 if api_wait_time > 3:
119 logger.warning(f"Rate limit reached, waiting for {api_wait_time}s")
120
121 await asyncio.sleep(api_wait_time)
122 item: Optional[str] = await self.queue.get()
123 try:
124 if not item:
125 continue
126 elif type(item) == tuple:
127 retries, url = item
128 elif item == GitHubPrefetcher.STOP:
129 break
130 else:
131 url = item
132 retries = 0
133
134 # Fetch the github repo data which will store it in a cache
135 try:
136 logger.info(f"Attempting to prefetch repository data for: `{url}`")
137 _ = await non_blocking(GitHub.from_url, url)
138 except NoSuchRepository:
139 logger.warning(f"GitHub repository does not exists or access was denied: `{url}`")
140 except RateLimitError:
141 logger.warning(f"GitHub reate limit reached")
142 await self.queue.put(url)
143 except Exception:
144 logger.exception(f"An error occurred while prefetching the repository data: {retries} retries")
145 if retries < max_retries:
146 retries += 1
147 await asyncio.sleep(backoff*retries)
148 await self.queue.put((retries, url))
149 finally:
150 self.queue.task_done()
151
152
153def update_rate_limits(response: requests.Response, **kwargs):

Callers 1

prefetch_mirrorFunction · 0.95

Calls 4

non_blockingFunction · 0.85
getMethod · 0.80
putMethod · 0.80
task_doneMethod · 0.80

Tested by

no test coverage detected