diff --git a/README.md b/README.md
index f582861..91a432e 100644
--- a/README.md
+++ b/README.md
@@ -68,11 +68,7 @@ resulting log entries (which is up to you to implement), and then for each one,
calling the `ISyncService.SyncEntityIfEligible` method to process just that one
entity. This allows you to break down large synchronization operations into
smaller, manageable pieces, while still keeping track of the overall synchronization
-state of the entity. Note that this currently will not consider eligibility
-when determining whether to enqueue the entity, because that will be done when
-the `SyncEntityIfEligible` method is called. This means that you can enqueue
-entities that are not currently eligible for synchronization, and in case they
-become eligible before the next sync run, they will be processed as part of that run.
+state of the entity.
## Installation
diff --git a/Syncerbell/ISyncQueueService.cs b/Syncerbell/ISyncQueueService.cs
index 97fa06d..209baaa 100644
--- a/Syncerbell/ISyncQueueService.cs
+++ b/Syncerbell/ISyncQueueService.cs
@@ -17,6 +17,7 @@ public interface ISyncQueueService
/// details in the sync log.
///
/// The type of trigger that initiated this sync operation (e.g., manual, timer).
+ /// Specifies whether to queue all entities or only those that are eligible for sync.
/// A cancellation token to cancel the operation if needed.
///
/// A read-only list of sync log entries that were created and queued for processing.
@@ -24,6 +25,7 @@ public interface ISyncQueueService
///
/// Thrown when the operation is cancelled via the cancellation token.
Task> CreateAllQueuedSyncEntries(SyncTriggerType syncTrigger,
+ QueueBehavior behavior = QueueBehavior.QueueEligibleOnly,
CancellationToken cancellationToken = default);
///
diff --git a/Syncerbell/QueueBehavior.cs b/Syncerbell/QueueBehavior.cs
new file mode 100644
index 0000000..bd15865
--- /dev/null
+++ b/Syncerbell/QueueBehavior.cs
@@ -0,0 +1,20 @@
+namespace Syncerbell;
+
+///
+/// Specifies the behavior for determining which entities should be queued for sync processing.
+///
+public enum QueueBehavior
+{
+ ///
+ /// Queue all entities regardless of their eligibility status.
+ /// This will create sync entries for every registered entity without checking sync eligibility strategies.
+ ///
+ QueueAll,
+
+ ///
+ /// Queue only entities that are eligible for sync according to their configured eligibility strategies.
+ /// This respects sync eligibility rules such as interval-based strategies or custom eligibility logic.
+ ///
+ QueueEligibleOnly
+
+}
diff --git a/Syncerbell/SyncQueueService.cs b/Syncerbell/SyncQueueService.cs
index 2c8944f..0c53ae7 100644
--- a/Syncerbell/SyncQueueService.cs
+++ b/Syncerbell/SyncQueueService.cs
@@ -13,6 +13,7 @@ public class SyncQueueService(
{
///
public async Task> CreateAllQueuedSyncEntries(SyncTriggerType syncTrigger,
+ QueueBehavior behavior = QueueBehavior.QueueEligibleOnly,
CancellationToken cancellationToken = default)
{
var entities = await entityResolver.ResolveEntities(cancellationToken);
@@ -38,6 +39,23 @@ public async Task> CreateAllQueuedSyncEntries(SyncT
continue;
}
+ // Check eligibility if behavior requires it
+ if (behavior == QueueBehavior.QueueEligibleOnly)
+ {
+ var trigger = new SyncTrigger
+ {
+ TriggerType = syncTrigger,
+ PriorSyncInfo = acquireResult.PriorSyncInfo
+ };
+
+ var isEligible = await entity.Eligibility.IsEligibleToSync(trigger, entity, cancellationToken);
+ if (!isEligible)
+ {
+ logger.LogDebug("Entity {EntityName} is not eligible for sync. Skipping queue creation.", entity.Entity);
+ continue;
+ }
+ }
+
// Mark the entry as queued
logEntry.SyncStatus = SyncStatus.Pending;
logEntry.QueuedAt = currentTime;