mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 08:58:09 +08:00
refactor(api): fix pyright check
- Replaced `is_editor` checks with `has_edit_permission` in `workflow_trigger.py` and `workflow.py` to enhance clarity and consistency in permission handling. - Updated the rate limiter to use `datetime.now(UTC)` instead of `datetime.utcnow()` for accurate time handling. - Added `__all__` declaration in `trigger/__init__.py` for better module export management. - Initialized `debug_dispatched` variable in `trigger_processing_tasks.py` to ensure proper tracking during workflow dispatching. These changes improve code readability and maintainability while ensuring correct permission checks and time management.
This commit is contained in:
@ -4,7 +4,7 @@ Day-based rate limiter for workflow executions.
|
||||
Implements UTC-based daily quotas that reset at midnight UTC for consistent rate limiting.
|
||||
"""
|
||||
|
||||
from datetime import datetime, time, timedelta
|
||||
from datetime import UTC, datetime, time, timedelta
|
||||
from typing import Union
|
||||
|
||||
import pytz
|
||||
@ -173,7 +173,7 @@ class TenantDailyRateLimiter:
|
||||
Datetime when quota resets (next UTC midnight in tenant's timezone)
|
||||
"""
|
||||
tz = pytz.timezone(timezone_str)
|
||||
utc_now = datetime.utcnow()
|
||||
utc_now = datetime.now(UTC)
|
||||
|
||||
# Get next midnight in UTC, then convert to tenant's timezone
|
||||
next_utc_midnight = datetime.combine(utc_now.date() + timedelta(days=1), time.min)
|
||||
|
||||
Reference in New Issue
Block a user