flagsmith-common 2.2.0__tar.gz → 2.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/PKG-INFO +5 -3
  2. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/pyproject.toml +1 -1
  3. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/templates/docgen-metrics.md +2 -0
  4. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/processor.py +16 -4
  5. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/LICENSE +0 -0
  6. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/README.md +0 -0
  7. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/__init__.py +0 -0
  8. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/__init__.py +0 -0
  9. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/app.py +0 -0
  10. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/cli/__init__.py +0 -0
  11. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/cli/healthcheck.py +0 -0
  12. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/logging.py +0 -0
  13. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/main.py +0 -0
  14. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/management/__init__.py +0 -0
  15. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/management/commands/__init__.py +0 -0
  16. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/management/commands/docgen.py +0 -0
  17. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/management/commands/start.py +0 -0
  18. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/management/commands/waitfordb.py +0 -0
  19. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/metrics.py +0 -0
  20. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/middleware.py +0 -0
  21. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/urls.py +0 -0
  22. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/utils.py +0 -0
  23. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/core/views.py +0 -0
  24. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/environments/permissions.py +0 -0
  25. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/features/__init__.py +0 -0
  26. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/features/multivariate/__init__.py +0 -0
  27. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/features/multivariate/serializers.py +0 -0
  28. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/features/serializers.py +0 -0
  29. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/features/versioning/__init__.py +0 -0
  30. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/features/versioning/serializers.py +0 -0
  31. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/gunicorn/__init__.py +0 -0
  32. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/gunicorn/conf.py +0 -0
  33. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/gunicorn/constants.py +0 -0
  34. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/gunicorn/logging.py +0 -0
  35. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/gunicorn/metrics.py +0 -0
  36. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/gunicorn/middleware.py +0 -0
  37. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/gunicorn/utils.py +0 -0
  38. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/migrations/__init__.py +0 -0
  39. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/migrations/helpers/__init__.py +0 -0
  40. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/migrations/helpers/postgres_helpers.py +0 -0
  41. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/organisations/permissions.py +0 -0
  42. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/projects/permissions.py +0 -0
  43. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/prometheus/__init__.py +0 -0
  44. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/prometheus/utils.py +0 -0
  45. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/py.typed +0 -0
  46. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/test_tools/__init__.py +0 -0
  47. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/test_tools/plugin.py +0 -0
  48. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/test_tools/types.py +0 -0
  49. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/test_tools/utils.py +0 -0
  50. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/common/types.py +0 -0
  51. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/__init__.py +0 -0
  52. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/admin.py +0 -0
  53. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/apps.py +0 -0
  54. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/decorators.py +0 -0
  55. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/exceptions.py +0 -0
  56. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/health.py +0 -0
  57. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/managers.py +0 -0
  58. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/metrics.py +0 -0
  59. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/0001_initial.py +0 -0
  60. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/0002_healthcheckmodel.py +0 -0
  61. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/0003_add_completed_to_task.py +0 -0
  62. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/0004_recreate_task_indexes.py +0 -0
  63. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/0005_update_conditional_index_conditions.py +0 -0
  64. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/0006_auto_20230221_0802.py +0 -0
  65. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/0007_add_is_locked.py +0 -0
  66. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/0008_add_get_task_to_process_function.py +0 -0
  67. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/0009_add_recurring_task_run_first_run_at.py +0 -0
  68. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/0010_task_priority.py +0 -0
  69. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/0011_add_priority_to_get_tasks_to_process.py +0 -0
  70. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/0012_add_locked_at_and_timeout.py +0 -0
  71. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/0013_add_last_picked_at.py +0 -0
  72. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/__init__.py +0 -0
  73. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/sql/0008_get_recurring_tasks_to_process.sql +0 -0
  74. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/sql/0008_get_tasks_to_process.sql +0 -0
  75. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/sql/0011_get_tasks_to_process.sql +0 -0
  76. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/sql/0012_get_recurringtasks_to_process.sql +0 -0
  77. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/sql/0013_get_recurringtasks_to_process.sql +0 -0
  78. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/migrations/sql/__init__.py +0 -0
  79. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/models.py +0 -0
  80. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/monitoring.py +0 -0
  81. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/py.typed +0 -0
  82. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/routers.py +0 -0
  83. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/serializers.py +0 -0
  84. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/task_registry.py +0 -0
  85. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/task_run_method.py +0 -0
  86. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/tasks.py +0 -0
  87. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/threads.py +0 -0
  88. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/types.py +0 -0
  89. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/urls.py +0 -0
  90. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/utils.py +0 -0
  91. {flagsmith_common-2.2.0 → flagsmith_common-2.2.2}/src/task_processor/views.py +0 -0
@@ -1,8 +1,9 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: flagsmith-common
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: Flagsmith's common library
5
- License: BSD-3-Clause
5
+ License-Expression: BSD-3-Clause
6
+ License-File: LICENSE
6
7
  Author: Matthew Elwell
7
8
  Maintainer: Flagsmith Team
8
9
  Maintainer-email: support@flagsmith.com
@@ -15,6 +16,7 @@ Classifier: Programming Language :: Python :: 3
15
16
  Classifier: Programming Language :: Python :: 3.11
16
17
  Classifier: Programming Language :: Python :: 3.12
17
18
  Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
18
20
  Provides-Extra: test-tools
19
21
  Requires-Dist: backoff (>=2.2.1,<3.0.0)
20
22
  Requires-Dist: django (>4,<5)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flagsmith-common"
3
- version = "2.2.0"
3
+ version = "2.2.2"
4
4
  description = "Flagsmith's common library"
5
5
  requires-python = ">=3.11,<4.0"
6
6
  dependencies = [
@@ -1,5 +1,7 @@
1
1
  ---
2
2
  title: Metrics
3
+ sidebar_label: Metrics
4
+ sidebar_position: 20
3
5
  ---
4
6
 
5
7
  ## Prometheus
@@ -128,12 +128,17 @@ def _run_task(
128
128
  )
129
129
  task_run: AnyTaskRun = task.task_runs.model(started_at=timezone.now(), task=task) # type: ignore[attr-defined]
130
130
  result: str
131
+ executor = None
131
132
 
132
133
  try:
133
- with ThreadPoolExecutor(max_workers=1) as executor:
134
- future = executor.submit(task.run)
135
- timeout = task.timeout.total_seconds() if task.timeout else None
136
- future.result(timeout=timeout) # Wait for completion or timeout
134
+ # Use explicit executor management to avoid blocking on shutdown
135
+ # when tasks timeout but continue running in worker threads.
136
+ # The default context manager behavior (wait=True) would block
137
+ # the TaskRunner thread indefinitely waiting for stuck workers.
138
+ executor = ThreadPoolExecutor(max_workers=1)
139
+ future = executor.submit(task.run)
140
+ timeout = task.timeout.total_seconds() if task.timeout else None
141
+ future.result(timeout=timeout) # Wait for completion or timeout
137
142
 
138
143
  task_run.result = result = TaskResult.SUCCESS.value
139
144
  task_run.finished_at = timezone.now()
@@ -176,6 +181,13 @@ def _run_task(
176
181
  delay_until,
177
182
  )
178
183
 
184
+ finally:
185
+ # Always shutdown the executor without waiting for worker threads.
186
+ # This prevents the TaskRunner thread from blocking indefinitely
187
+ # when a task times out but continues running in a worker thread.
188
+ if executor is not None:
189
+ executor.shutdown(wait=False)
190
+
179
191
  labels = {
180
192
  "task_identifier": task_identifier,
181
193
  "task_type": registered_task.task_type.value.lower(),