Skip to content

Commit 74341a9

Browse files
committed
Get rid of lighter color for pending strokes
1 parent 8d97b65 commit 74341a9

File tree

4 files changed

+14
-43
lines changed

4 files changed

+14
-43
lines changed

backend/services/graphql_retry_queue.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def add_to_retry_queue(stroke_id: str, asset_data: Dict[str, Any]) -> None:
6767
logger.info(f"Added stroke {stroke_id} to GraphQL retry queue")
6868
except redis.exceptions.RedisError as e:
6969
# Critical: Redis is down, log prominently
70-
logger.critical(f"⚠️ REDIS DOWN: Cannot queue stroke {stroke_id} for retry: {e}")
71-
logger.critical(f"⚠️ Stroke {stroke_id} will NOT be synced to blockchain unless manually recovered")
70+
logger.critical(f"REDIS DOWN: Cannot queue stroke {stroke_id} for retry: {e}")
71+
logger.critical(f"Stroke {stroke_id} will NOT be synced to blockchain unless manually recovered")
7272
except Exception as e:
7373
logger.error(f"Failed to add stroke {stroke_id} to retry queue: {e}")
7474

@@ -191,7 +191,7 @@ def process_retry_queue(max_items: int = 50) -> Dict[str, int]:
191191
}
192192

193193
txn_id = commit_transaction_via_graphql(prep)
194-
logger.info(f"RETRY SUCCESS: Stroke {stroke_id} committed to ResilientDB: {txn_id}")
194+
logger.info(f"RETRY SUCCESS: Stroke {stroke_id} committed to ResilientDB: {txn_id}")
195195

196196
# Remove from queue on success - use deterministic JSON serialization
197197
retry_item_json = json.dumps(item, sort_keys=True)
@@ -201,7 +201,7 @@ def process_retry_queue(max_items: int = 50) -> Dict[str, int]:
201201
except Exception as e:
202202
# Increment attempts and keep in queue
203203
new_attempts = increment_retry_attempts(stroke_id)
204-
logger.warning(f"⚠️ RETRY FAILED (attempt {new_attempts}/{MAX_RETRY_ATTEMPTS}): Stroke {stroke_id}: {str(e)}")
204+
logger.warning(f"RETRY FAILED (attempt {new_attempts}/{MAX_RETRY_ATTEMPTS}): Stroke {stroke_id}: {str(e)}")
205205
stats["failed"] += 1
206206

207207
if stats["success"] > 0 or stats["failed"] > 0:

backend/services/graphql_retry_worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _retry_worker_loop():
2727
# Wait a bit for Redis/MongoDB to be fully ready before starting
2828
time.sleep(2)
2929

30-
logger.info("🚀 GraphQL Retry Worker started (background thread)")
30+
logger.info("GraphQL Retry Worker started (background thread)")
3131
logger.info(f"Configuration: RETRY_INTERVAL={RETRY_INTERVAL_SECONDS}s, BATCH_SIZE={BATCH_SIZE}")
3232

3333
iteration = 0

backend/workers/graphql_retry_worker.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
def main():
3636
"""Main worker loop."""
37-
logger.info("🚀 GraphQL Retry Worker starting...")
37+
logger.info("GraphQL Retry Worker starting...")
3838
logger.info(f"Configuration: RETRY_INTERVAL={RETRY_INTERVAL_SECONDS}s, BATCH_SIZE={BATCH_SIZE}")
3939

4040
iteration = 0
@@ -48,15 +48,15 @@ def main():
4848
queue_size = get_queue_size()
4949

5050
if queue_size > 0:
51-
logger.info(f"📊 Iteration {iteration}: Processing retry queue ({queue_size} items pending)")
51+
logger.info(f"Iteration {iteration}: Processing retry queue ({queue_size} items pending)")
5252

5353
# Process batch
5454
stats = process_retry_queue(max_items=BATCH_SIZE)
5555

5656
if stats['success'] > 0 or stats['failed'] > 0:
5757
remaining = get_queue_size()
5858
logger.info(
59-
f"Batch complete: {stats['success']} synced, "
59+
f"Batch complete: {stats['success']} synced, "
6060
f"{stats['failed']} failed, {stats['skipped']} skipped. "
6161
f"Remaining: {remaining}"
6262
)
@@ -67,16 +67,16 @@ def main():
6767
except KeyboardInterrupt:
6868
raise # Re-raise to exit gracefully
6969
except Exception as e:
70-
logger.error(f"Error in worker iteration {iteration}: {e}")
70+
logger.error(f"Error in worker iteration {iteration}: {e}")
7171
logger.exception("Full traceback:")
7272

7373
# Wait before next iteration
7474
time.sleep(RETRY_INTERVAL_SECONDS)
7575

7676
except KeyboardInterrupt:
77-
logger.info("🛑 Worker stopped by user (Ctrl+C)")
77+
logger.info("Worker stopped by user (Ctrl+C)")
7878
except Exception as e:
79-
logger.error(f"💥 Worker crashed: {e}")
79+
logger.error(f"Worker crashed: {e}")
8080
logger.exception("Full traceback:")
8181
sys.exit(1)
8282

frontend/src/components/Canvas.js

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -918,8 +918,6 @@ function Canvas({
918918
drawingType: "stamp",
919919
stampData: stamp,
920920
stampSettings: settings,
921-
isPending: true, // Mark as pending for visual confirmation
922-
opacity: 0.5, // Reduced opacity for pending stamps
923921
}
924922
);
925923

@@ -952,14 +950,7 @@ function Canvas({
952950
console.log("Stamp submitted successfully:", stampDrawing.drawingId);
953951

954952
// Mark stamp as confirmed
955-
stampDrawing.isPending = false;
956-
stampDrawing.opacity = 1.0;
957953
confirmedStrokesRef.current.add(stampDrawing.drawingId);
958-
959-
// Trigger a redraw to show the confirmed state
960-
requestAnimationFrame(() => {
961-
drawAllDrawings();
962-
});
963954

964955
if (currentRoomId) {
965956
checkUndoRedoAvailability(
@@ -2064,10 +2055,8 @@ function Canvas({
20642055
}
20652056
}
20662057

2067-
// Apply opacity for pending strokes (visual confirmation)
2068-
if (drawing.isPending) {
2069-
offscreenContext.globalAlpha *= 0.5;
2070-
} else if (drawing.opacity !== undefined && drawing.opacity !== 1.0) {
2058+
// Apply custom opacity if specified
2059+
if (drawing.opacity !== undefined && drawing.opacity !== 1.0) {
20712060
offscreenContext.globalAlpha *= drawing.opacity;
20722061
}
20732062

@@ -3457,8 +3446,6 @@ function Canvas({
34573446
brushType: currentBrushType,
34583447
brushParams: brushParams,
34593448
drawingType: "stroke",
3460-
isPending: true, // Mark as pending for visual confirmation
3461-
opacity: 0.5, // Reduced opacity for pending strokes
34623449
}
34633450
);
34643451
newDrawing.roomId = currentRoomId;
@@ -3497,15 +3484,8 @@ function Canvas({
34973484
setRedoAvailable
34983485
);
34993486

3500-
// Mark stroke as confirmed by updating it in userData
3501-
newDrawing.isPending = false;
3502-
newDrawing.opacity = 1.0;
3487+
// Mark stroke as confirmed
35033488
confirmedStrokesRef.current.add(newDrawing.drawingId);
3504-
3505-
// Trigger a redraw to show the confirmed state
3506-
requestAnimationFrame(() => {
3507-
drawAllDrawings();
3508-
});
35093489

35103490
if (currentRoomId) {
35113491
checkUndoRedoAvailability(
@@ -3609,8 +3589,6 @@ function Canvas({
36093589
brushType: currentBrushType,
36103590
brushParams: brushParams,
36113591
drawingType: "shape",
3612-
isPending: true, // Mark as pending for visual confirmation
3613-
opacity: 0.5, // Reduced opacity for pending strokes
36143592
}
36153593
);
36163594
newDrawing.roomId = currentRoomId;
@@ -3641,14 +3619,7 @@ function Canvas({
36413619
);
36423620

36433621
// Mark stroke as confirmed
3644-
newDrawing.isPending = false;
3645-
newDrawing.opacity = 1.0;
36463622
confirmedStrokesRef.current.add(newDrawing.drawingId);
3647-
3648-
// Trigger a redraw to show the confirmed state
3649-
requestAnimationFrame(() => {
3650-
drawAllDrawings();
3651-
});
36523623

36533624
// Update undo/redo availability after shape submission
36543625
if (currentRoomId) {

0 commit comments

Comments
 (0)