-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb61dd7
commit ffe53a5
Showing
16 changed files
with
134 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 4 additions & 16 deletions
20
src/Farfetch.LoadShedding/Events/Args/ItemProcessedEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,22 @@ | ||
using System; | ||
using System; | ||
using Farfetch.LoadShedding.Tasks; | ||
|
||
namespace Farfetch.LoadShedding.Events.Args | ||
{ | ||
/// <summary> | ||
/// Event args for task processed event. | ||
/// </summary> | ||
public class ItemProcessedEventArgs : ItemEventArgs | ||
public class ItemProcessedEventArgs : TaskItemEventArgs | ||
{ | ||
internal ItemProcessedEventArgs(Priority priority, TimeSpan processingTime, int concurrencyLimit, int concurrencyCount) | ||
: base(priority) | ||
internal ItemProcessedEventArgs(Priority priority, TimeSpan processingTime, IReadOnlyCounter concurrencyCounter) | ||
: base(priority, concurrencyCounter) | ||
{ | ||
this.ProcessingTime = processingTime; | ||
this.ConcurrencyLimit = concurrencyLimit; | ||
this.ConcurrencyCount = concurrencyCount; | ||
} | ||
|
||
/// <summary> | ||
/// Gets time spent to process the task. | ||
/// </summary> | ||
public TimeSpan ProcessingTime { get; } | ||
|
||
/// <summary> | ||
/// Gets the current concurrency limit. | ||
/// </summary> | ||
public int ConcurrencyLimit { get; } | ||
|
||
/// <summary> | ||
/// Gets the current concurrency items count. | ||
/// </summary> | ||
public int ConcurrencyCount { get; } | ||
} | ||
} |
22 changes: 5 additions & 17 deletions
22
src/Farfetch.LoadShedding/Events/Args/ItemProcessingEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,15 @@ | ||
using Farfetch.LoadShedding.Tasks; | ||
using Farfetch.LoadShedding.Tasks; | ||
|
||
namespace Farfetch.LoadShedding.Events.Args | ||
{ | ||
/// <summary> | ||
/// Event args for task procssing event. | ||
/// Event args for task processing event. | ||
/// </summary> | ||
public class ItemProcessingEventArgs : ItemEventArgs | ||
public class ItemProcessingEventArgs : TaskItemEventArgs | ||
{ | ||
internal ItemProcessingEventArgs(Priority priority, int concurrencyLimit, int concurrencyCount) | ||
: base(priority) | ||
internal ItemProcessingEventArgs(Priority priority, IReadOnlyCounter concurrencyCounter) | ||
: base(priority, concurrencyCounter) | ||
{ | ||
this.ConcurrencyLimit = concurrencyLimit; | ||
this.ConcurrencyCount = concurrencyCount; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the current concurrency limit. | ||
/// </summary> | ||
public int ConcurrencyLimit { get; } | ||
|
||
/// <summary> | ||
/// Gets the current concurrency items count. | ||
/// </summary> | ||
public int ConcurrencyCount { get; } | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/Farfetch.LoadShedding/Events/Args/TaskItemEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Farfetch.LoadShedding.Tasks; | ||
|
||
namespace Farfetch.LoadShedding.Events.Args | ||
{ | ||
/// <summary> | ||
/// Event args for task item event. | ||
/// </summary> | ||
public class TaskItemEventArgs : ItemEventArgs | ||
{ | ||
private readonly IReadOnlyCounter _concurrencyCounter; | ||
|
||
internal TaskItemEventArgs(Priority priority, IReadOnlyCounter concurrencyCounter) | ||
: base(priority) | ||
{ | ||
_concurrencyCounter = concurrencyCounter; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the current concurrency limit. | ||
/// </summary> | ||
public int ConcurrencyLimit => _concurrencyCounter.Limit; | ||
|
||
/// <summary> | ||
/// Gets the current concurrency items count. | ||
/// </summary> | ||
public int ConcurrencyCount => _concurrencyCounter.Count; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/Farfetch.LoadShedding/Events/Args/TaskQueueEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Farfetch.LoadShedding.Tasks; | ||
|
||
namespace Farfetch.LoadShedding.Events.Args | ||
{ | ||
/// <summary> | ||
/// Event args for the task queue event. | ||
/// </summary> | ||
public class TaskQueueEventArgs : ItemEventArgs | ||
{ | ||
private readonly IReadOnlyCounter _queueCounter; | ||
|
||
internal TaskQueueEventArgs(Priority priority, IReadOnlyCounter queueCounter) | ||
: base(priority) | ||
{ | ||
this._queueCounter = queueCounter; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the maximum number of items in the queue. | ||
/// </summary> | ||
public int QueueLimit => _queueCounter.Limit; | ||
|
||
/// <summary> | ||
/// Gets the current number of items in the queue. | ||
/// </summary> | ||
public int QueueCount => _queueCounter.Count; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Farfetch.LoadShedding.Tasks | ||
{ | ||
internal interface IReadOnlyCounter | ||
{ | ||
int Count { get; } | ||
|
||
int Limit { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.