MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / _select_next_project

Method _select_next_project

src/services/token_manager.py:191–205  ·  view source on GitHub ↗

Select the next project from the pool in round-robin order.

(self, token: Token, projects: List[Project])

Source from the content-addressed store, hash-verified

189 return project
190
191 def _select_next_project(self, token: Token, projects: List[Project]) -> Project:
192 """Select the next project from the pool in round-robin order."""
193 ordered_projects = self._sort_projects(projects)
194 if not ordered_projects:
195 raise ValueError("No available projects for token")
196
197 if len(ordered_projects) == 1:
198 return ordered_projects[0]
199
200 if token.current_project_id:
201 for index, project in enumerate(ordered_projects):
202 if project.project_id == token.current_project_id:
203 return ordered_projects[(index + 1) % len(ordered_projects)]
204
205 return ordered_projects[0]
206
207 # ========== Token CRUD ==========
208

Callers 1

ensure_project_existsMethod · 0.95

Calls 1

_sort_projectsMethod · 0.95

Tested by

no test coverage detected