fix: periodic register reload in approval scanner + direct project_name access
This commit is contained in:
7
bot.py
7
bot.py
@@ -322,8 +322,11 @@ class GravityBot(commands.Bot):
|
|||||||
|
|
||||||
@tasks.loop(seconds=3)
|
@tasks.loop(seconds=3)
|
||||||
async def pending_approval_scanner(self):
|
async def pending_approval_scanner(self):
|
||||||
"""Scan bridge/pending/ for new approval requests."""
|
"""Scan bridge/pending/ for new approval requests + reload registrations."""
|
||||||
try:
|
try:
|
||||||
|
# Reload conv→project registrations each cycle
|
||||||
|
self._load_registrations()
|
||||||
|
|
||||||
requests = self.bridge.get_pending_requests()
|
requests = self.bridge.get_pending_requests()
|
||||||
for req in requests:
|
for req in requests:
|
||||||
if req.request_id in self._sent_approval_ids:
|
if req.request_id in self._sent_approval_ids:
|
||||||
@@ -332,7 +335,7 @@ class GravityBot(commands.Bot):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Learn project mapping from pending approval
|
# Learn project mapping from pending approval
|
||||||
project = getattr(req, 'project_name', '') or Config.PROJECT_NAME
|
project = req.project_name or Config.PROJECT_NAME
|
||||||
if req.conversation_id and req.conversation_id != '__global__':
|
if req.conversation_id and req.conversation_id != '__global__':
|
||||||
self.conv_to_project[req.conversation_id] = project
|
self.conv_to_project[req.conversation_id] = project
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user