mirror of
https://github.com/hoshikawa2/agent_platform_oci.git
synced 2026-09-07 10:13:46 +00:00
bugfix: Pubsub sequence. Em algumas situacoes, o MongoDB permite especificar a chave em operacoes update, porém Autonomous nao e permissivo para esta e outras situacoes
This commit is contained in:
@@ -175,6 +175,20 @@ def _next_sequence_mongodb_sync(
|
|||||||
now = datetime.now(timezone.utc)
|
now = datetime.now(timezone.utc)
|
||||||
expires_at = now + timedelta(seconds=ttl_seconds) if ttl_seconds > 0 else None
|
expires_at = now + timedelta(seconds=ttl_seconds) if ttl_seconds > 0 else None
|
||||||
|
|
||||||
|
# update: dict[str, Any] = {
|
||||||
|
# "$inc": {"sequence": 1},
|
||||||
|
# "$set": {
|
||||||
|
# "agentId": agent_id or os.getenv("AGENT_NAME") or "agent",
|
||||||
|
# "sessionId": session_id,
|
||||||
|
# "transactionId": transaction_id,
|
||||||
|
# "sequenceScope": "transaction" if transaction_id else "session",
|
||||||
|
# "updatedAt": now,
|
||||||
|
# },
|
||||||
|
# "$setOnInsert": {
|
||||||
|
# "_id": key,
|
||||||
|
# "createdAt": now,
|
||||||
|
# },
|
||||||
|
# }
|
||||||
update: dict[str, Any] = {
|
update: dict[str, Any] = {
|
||||||
"$inc": {"sequence": 1},
|
"$inc": {"sequence": 1},
|
||||||
"$set": {
|
"$set": {
|
||||||
@@ -185,7 +199,6 @@ def _next_sequence_mongodb_sync(
|
|||||||
"updatedAt": now,
|
"updatedAt": now,
|
||||||
},
|
},
|
||||||
"$setOnInsert": {
|
"$setOnInsert": {
|
||||||
"_id": key,
|
|
||||||
"createdAt": now,
|
"createdAt": now,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user