Skip to content

Commit

Permalink
Added more cases to JSONKey
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Connolly committed Sep 6, 2017
1 parent c36aa4e commit 38c8ca0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Sources/Decoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct Decoder {
func decode(data: Foundation.Data) throws -> DecoderResult {
let json = try data.jsonDictionary(key: String.self, value: Any.self)

let taskType = TaskType(json["taskType"] as? String ?? "")
let taskType = TaskType(json[.taskType] as? String ?? "")

switch taskType {
case .chain:
Expand All @@ -47,7 +47,7 @@ struct Decoder {


func decode(chain json: [String : Any]) throws -> Chain {
guard let chain = json["chain"] as? [[String : Any]] else {
guard let chain = json[.chain] as? [[String : Any]] else {
throw SwiftQError.taskNotFound
}

Expand Down
13 changes: 13 additions & 0 deletions Sources/JSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,16 @@ public struct JSON {
}

}

enum JSONKey: String {
case taskName
case identification
case args
case error
case errorAt
case consumer
case chain
case createdAt
case uuid
case taskType
}
15 changes: 1 addition & 14 deletions Sources/SwiftQProducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public final class SwiftQProducer {
private let scheduledQueue: ScheduledQueue

public init(redisConfig: RedisConfig) throws {
self.reliableQueue = try ReliableQueue(config: redisConfig)
self.reliableQueue = try ReliableQueue(config: redisConfig, concurrency: 4)
self.scheduledQueue = try ScheduledQueue(config: redisConfig)

if redisConfig.password == nil {
Expand Down Expand Up @@ -54,16 +54,3 @@ public final class SwiftQProducer {
}

}


enum JSONKey: String {
case taskName
case identification
case args
case error
case errorAt
case consumer
case chain
case createdAt
case uuid
}

0 comments on commit 38c8ca0

Please sign in to comment.