Spaces:
Running
Running
zzstoatzz Claude commited on
Commit ·
fdd3b47
1
Parent(s): bbbf830
Add delay between thread posts to ensure proper indexing
Browse files- Add 0.5s sleep between posts in create_thread
- Prevents 'Parent post not found' errors
- Ensures each post is indexed before creating replies
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
examples/atproto_mcp/src/atproto_mcp/_atproto/_posts.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
"""Unified posting functionality."""
|
| 2 |
|
|
|
|
| 3 |
from datetime import datetime
|
| 4 |
|
| 5 |
from atproto import models
|
|
@@ -334,6 +335,9 @@ def create_thread(posts: list[ThreadPost]) -> ThreadResult:
|
|
| 334 |
root_uri = result["uri"]
|
| 335 |
parent_uri = root_uri
|
| 336 |
post_uris.append(root_uri)
|
|
|
|
|
|
|
|
|
|
| 337 |
else:
|
| 338 |
# Subsequent posts reply to the previous one
|
| 339 |
result = create_post(
|
|
@@ -359,6 +363,10 @@ def create_thread(posts: list[ThreadPost]) -> ThreadResult:
|
|
| 359 |
parent_uri = result["uri"]
|
| 360 |
post_uris.append(parent_uri)
|
| 361 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 362 |
return ThreadResult(
|
| 363 |
success=True,
|
| 364 |
thread_uri=root_uri,
|
|
|
|
| 1 |
"""Unified posting functionality."""
|
| 2 |
|
| 3 |
+
import time
|
| 4 |
from datetime import datetime
|
| 5 |
|
| 6 |
from atproto import models
|
|
|
|
| 335 |
root_uri = result["uri"]
|
| 336 |
parent_uri = root_uri
|
| 337 |
post_uris.append(root_uri)
|
| 338 |
+
|
| 339 |
+
# Small delay to ensure post is indexed
|
| 340 |
+
time.sleep(0.5)
|
| 341 |
else:
|
| 342 |
# Subsequent posts reply to the previous one
|
| 343 |
result = create_post(
|
|
|
|
| 363 |
parent_uri = result["uri"]
|
| 364 |
post_uris.append(parent_uri)
|
| 365 |
|
| 366 |
+
# Small delay between posts
|
| 367 |
+
if i < len(posts) - 1:
|
| 368 |
+
time.sleep(0.5)
|
| 369 |
+
|
| 370 |
return ThreadResult(
|
| 371 |
success=True,
|
| 372 |
thread_uri=root_uri,
|