Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: reduce memory and cpu usage while running background queue (#379)
- Loading branch information
1 parent
f304189
commit 87a7eed
Showing
22 changed files
with
173 additions
and
361 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
16 changes: 16 additions & 0 deletions
16
Sources/Common/Background Queue/Task Data/DeletePushNotificationQueueTaskData.swift
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,16 @@ | ||
import Foundation | ||
|
||
public struct DeletePushNotificationQueueTaskData: Codable { | ||
public let profileIdentifier: String | ||
public let deviceToken: String | ||
|
||
public init(profileIdentifier: String, deviceToken: String) { | ||
self.profileIdentifier = profileIdentifier | ||
self.deviceToken = deviceToken | ||
} | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case profileIdentifier = "profile_identifier" | ||
case deviceToken = "device_token" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Sources/Common/Background Queue/Task Data/IdentifyProfileQueueTaskData.swift
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,17 @@ | ||
import Foundation | ||
|
||
public struct IdentifyProfileQueueTaskData: Codable { | ||
public let identifier: String | ||
/// JSON string: '{"foo": "bar"}' | ||
public let attributesJsonString: String? | ||
|
||
public init(identifier: String, attributesJsonString: String?) { | ||
self.identifier = identifier | ||
self.attributesJsonString = attributesJsonString | ||
} | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case identifier | ||
case attributesJsonString = "attributes_json_string" | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Sources/Common/Background Queue/Task Data/RegisterPushNotificationQueueTaskData.swift
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,16 @@ | ||
import Foundation | ||
|
||
public struct RegisterPushNotificationQueueTaskData: Codable { | ||
public let profileIdentifier: String | ||
public let attributesJsonString: String? | ||
|
||
public init(profileIdentifier: String, attributesJsonString: String?) { | ||
self.profileIdentifier = profileIdentifier | ||
self.attributesJsonString = attributesJsonString | ||
} | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case profileIdentifier = "profile_identifier" | ||
case attributesJsonString = "attributes_json_string" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Sources/Common/Background Queue/Task Data/TrackEventQueueTaskData.swift
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,17 @@ | ||
import Foundation | ||
|
||
public struct TrackEventQueueTaskData: Codable { | ||
public let identifier: String | ||
/// JSON string: '{"foo": "bar"}' | ||
public let attributesJsonString: String | ||
|
||
public init(identifier: String, attributesJsonString: String) { | ||
self.identifier = identifier | ||
self.attributesJsonString = attributesJsonString | ||
} | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case identifier | ||
case attributesJsonString = "attributes_json_string" | ||
} | ||
} |
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,5 +1,10 @@ | ||
import Foundation | ||
|
||
enum QueueTaskType: String { | ||
public enum QueueTaskType: String { | ||
case trackDeliveryMetric | ||
case identifyProfile | ||
case trackEvent | ||
case registerPushToken | ||
case deletePushToken | ||
case trackPushMetric | ||
} |
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.
Run