botrun-flow-lang 5.12.261__py3-none-any.whl → 5.12.263__py3-none-any.whl
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.
- botrun_flow_lang/services/hatch/hatch_fs_store.py +32 -0
- {botrun_flow_lang-5.12.261.dist-info → botrun_flow_lang-5.12.263.dist-info}/METADATA +1 -1
- {botrun_flow_lang-5.12.261.dist-info → botrun_flow_lang-5.12.263.dist-info}/RECORD +4 -4
- {botrun_flow_lang-5.12.261.dist-info → botrun_flow_lang-5.12.263.dist-info}/WHEEL +0 -0
|
@@ -61,6 +61,38 @@ class HatchFsStore(FirestoreBase):
|
|
|
61
61
|
order: str = "desc",
|
|
62
62
|
) -> Tuple[List[Hatch], str]:
|
|
63
63
|
try:
|
|
64
|
+
# 向下兼容:先找出没有 updated_at 字段的记录并批量更新
|
|
65
|
+
# 注意:Firestore 不支持直接筛选"字段不存在",必须遍历所有记录
|
|
66
|
+
if sort_by == "updated_at":
|
|
67
|
+
missing_query = self.collection.where(
|
|
68
|
+
filter=firestore.FieldFilter("user_id", "==", user_id)
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# 收集需要更新的文档
|
|
72
|
+
docs_to_update = []
|
|
73
|
+
current_time = datetime.now(timezone.utc).isoformat()
|
|
74
|
+
|
|
75
|
+
for doc in missing_query.stream():
|
|
76
|
+
data = doc.to_dict()
|
|
77
|
+
# 如果没有 updated_at 字段或为空,收集起来
|
|
78
|
+
if "updated_at" not in data or not data.get("updated_at"):
|
|
79
|
+
docs_to_update.append((doc.reference, data))
|
|
80
|
+
|
|
81
|
+
# 使用批量写入更新(每批最多 500 个)
|
|
82
|
+
if docs_to_update:
|
|
83
|
+
batch_size = 500
|
|
84
|
+
for i in range(0, len(docs_to_update), batch_size):
|
|
85
|
+
batch = self.db.batch()
|
|
86
|
+
batch_docs = docs_to_update[i:i + batch_size]
|
|
87
|
+
|
|
88
|
+
for doc_ref, data in batch_docs:
|
|
89
|
+
data["updated_at"] = current_time
|
|
90
|
+
batch.set(doc_ref, data)
|
|
91
|
+
|
|
92
|
+
batch.commit()
|
|
93
|
+
|
|
94
|
+
logging.info(f"Auto-migrated {len(docs_to_update)} hatches with updated_at for user {user_id}")
|
|
95
|
+
|
|
64
96
|
# Build base query
|
|
65
97
|
query = self.collection.where(
|
|
66
98
|
filter=firestore.FieldFilter("user_id", "==", user_id)
|
|
@@ -66,7 +66,7 @@ botrun_flow_lang/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
|
66
66
|
botrun_flow_lang/services/base/firestore_base.py,sha256=Z561TzGvYOUmGKc3IQh03nsK8XHCa96Nlx5m23TySks,1045
|
|
67
67
|
botrun_flow_lang/services/hatch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
68
|
botrun_flow_lang/services/hatch/hatch_factory.py,sha256=ObCcb_hTp8YFXRNXOsXtI_dND_dz7cusypF2tDnMqYY,271
|
|
69
|
-
botrun_flow_lang/services/hatch/hatch_fs_store.py,sha256=
|
|
69
|
+
botrun_flow_lang/services/hatch/hatch_fs_store.py,sha256=zC12eVM0p6q1KDpDxjLFK4608BVIurnFPNm2Du-YmSM,15128
|
|
70
70
|
botrun_flow_lang/services/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
71
71
|
botrun_flow_lang/services/storage/storage_cs_store.py,sha256=5NQekxfzjH6420QHi6HxLFHM5qY9kfiYis-dmsyuHO4,7896
|
|
72
72
|
botrun_flow_lang/services/storage/storage_factory.py,sha256=Yn40nB79qoEvClksIRnRpQGojXT4J4q1ExBqb3ydets,354
|
|
@@ -97,6 +97,6 @@ botrun_flow_lang/utils/yaml_utils.py,sha256=1A6PSEE8TM0HSD_6l-fhUsjYnXJcrEKuPgot
|
|
|
97
97
|
botrun_flow_lang/utils/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
98
98
|
botrun_flow_lang/utils/clients/rate_limit_client.py,sha256=TRpA56OKrfYsoLoJ-TPYlC7Znp9s267-u6CX6BLyVko,8349
|
|
99
99
|
botrun_flow_lang/utils/clients/token_verify_client.py,sha256=BtrfLvMe-DtS8UKeDhaIkVKDZHphZVP7kyqXn9jhXEc,5740
|
|
100
|
-
botrun_flow_lang-5.12.
|
|
101
|
-
botrun_flow_lang-5.12.
|
|
102
|
-
botrun_flow_lang-5.12.
|
|
100
|
+
botrun_flow_lang-5.12.263.dist-info/METADATA,sha256=NBDjdwb1_9X9AwfdsVeVr3-JyYsN1Mio1-vYtdG8JJ0,6221
|
|
101
|
+
botrun_flow_lang-5.12.263.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
102
|
+
botrun_flow_lang-5.12.263.dist-info/RECORD,,
|
|
File without changes
|