Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #342

Merged
merged 2 commits into from
Jun 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/SwiftQueue/Constraint+Network.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ internal final class NetworkConstraint: SimpleConstraint, CodableConstraint {
override func run(operation: SqOperation) -> Bool {
guard let reachability = reachability else { return true }

if (hasCorrectNetwork(reachability: reachability)) {
if hasCorrectNetwork(reachability: reachability) {
return true
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftQueue/ConstraintMaker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ class DefaultConstraintMaker: ConstraintMaker {
return constraints
}

}
}
1 change: 0 additions & 1 deletion Sources/SwiftQueue/JobInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,3 @@ extension JobInfo: Codable {
}
}
}

2 changes: 1 addition & 1 deletion Sources/SwiftQueue/SqOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public final class SqOperation: Operation {
public let logger: SwiftQueueLogger
public let dispatchQueue: DispatchQueue

public var nextRunSchedule: Date? = nil
public var nextRunSchedule: Date?

internal let handler: Job
internal var lastError: Error?
Expand Down
67 changes: 0 additions & 67 deletions Tests/SwiftQueueTests/PersisterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,64 +216,6 @@ class PersisterTests: XCTestCase {
XCTAssertEqual([group], persister.removeQueueName)
}

// func testScheduleWhileDeserialize() {
// let queueId = UUID().uuidString
//
// let persister = PersisterTracker(key: UUID().uuidString)
//
// var tasks = [String: TestJob]()
//
// for i in 0..<100 {
// let (type, job) = (UUID().uuidString, TestJob())
//
// let task = JobBuilder(type: type)
// .singleInstance(forId: "\(i)")
// .parallel(queueName: queueId)
// .build(job: job)
// .toJSONStringSafe()
//
// persister.put(queueName: queueId, taskId: "\(i)", data: task)
//
// tasks[type] = job
// }
//
// let lastTaskType = UUID().uuidString
// let lastJob = TestJob()
//
// tasks[lastTaskType] = lastJob
//
// let creator = TestCreator(tasks)
// let manager = SwiftQueueManagerBuilder(creator: creator).set(persister: persister).set(initInBackground: true).build()
//
// JobBuilder(type: lastTaskType)
// .singleInstance(forId: lastTaskType)
// .parallel(queueName: queueId)
// .persist()
// .schedule(manager: manager)
//
// lastJob.awaitForRemoval()
//
// // At this point all the other jobs should be completed
// manager.cancelAllOperations()
//
// lastJob.assertSingleCompletion()
//
// for (_, task) in tasks {
// task.assertSingleCompletion()
// }
// }

// public func testBuilderWith() throws {
// for serializer in serializers {
// try assertUnicode(serializer, expected: UUID().uuidString)
// try assertUnicode(serializer, expected: "Hello world")
// try assertUnicode(serializer, expected: "Powerلُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ冗")
// try assertUnicode(serializer, expected: "🏳0🌈")
// try assertUnicode(serializer, expected: "🤪🤯🧐")
// try assertUnicode(serializer, expected: "జ్ఞ‌ా")
// }
// }

func testCustomSerializer() {
let (type1, job1) = (UUID().uuidString, TestJob())

Expand Down Expand Up @@ -314,13 +256,4 @@ class PersisterTests: XCTestCase {
persister.clearAll()
}

// private func assertUnicode(_ serializer: JobInfoSerializer, expected: String, file: StaticString = #file, line: UInt = #line) throws {
// let type = UUID().uuidString
//
// let params: [String: Any] = [UUID().uuidString: expected]
//
// let jobInfo = JobBuilder(type: type).with(params: params).info
// XCTAssertTrue(NSDictionary(dictionary: params).isEqual(to: jobInfo.params), file: file, line: line)
// }

}