Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/no-carrier.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Rebert <code@rebertia.com>2015-04-25 23:30:55 +0300
committerChris Rebert <code@rebertia.com>2015-04-25 23:31:09 +0300
commitd7a4f25842554c77e3251571b8b129b0add4f8ee (patch)
tree4f1abf39061b443bf42b5fa18dd0924a9644d56b /src
parentea278f282cebd446537ff3eac55c39d587c27289 (diff)
RetryWire => RetryCarefulWire
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/com/getbootstrap/no_carrier/Main.scala3
-rw-r--r--src/main/scala/com/getbootstrap/no_carrier/github/Credentials.scala2
-rw-r--r--src/main/scala/com/getbootstrap/no_carrier/http/SuperWire.scala9
3 files changed, 7 insertions, 7 deletions
diff --git a/src/main/scala/com/getbootstrap/no_carrier/Main.scala b/src/main/scala/com/getbootstrap/no_carrier/Main.scala
index e804ef3..095ced4 100644
--- a/src/main/scala/com/getbootstrap/no_carrier/Main.scala
+++ b/src/main/scala/com/getbootstrap/no_carrier/Main.scala
@@ -22,10 +22,11 @@ object Main extends App with StrictLogging {
val enabled = false
implicit val clock = Clock.systemUTC
implicit val userAgent = new UserAgent("NoCarrier/0.1 (https://github.com/twbs/no-carrier)")
+ val rateLimitThreshold = 10
val arguments = (args.toSeq match {
case Seq(username, password, RepositoryId(repoId), NonEmptyStr(label), IntFromStr(PositiveInt(dayCount))) => {
Some(Arguments(
- Credentials(username = username, password = password).github,
+ Credentials(username = username, password = password).github(rateLimitThreshold),
repoId = repoId,
label = label,
timeout = java.time.Duration.ofDays(dayCount)
diff --git a/src/main/scala/com/getbootstrap/no_carrier/github/Credentials.scala b/src/main/scala/com/getbootstrap/no_carrier/github/Credentials.scala
index 1579aa3..01502f0 100644
--- a/src/main/scala/com/getbootstrap/no_carrier/github/Credentials.scala
+++ b/src/main/scala/com/getbootstrap/no_carrier/github/Credentials.scala
@@ -5,5 +5,5 @@ import com.getbootstrap.no_carrier.http.{UserAgent, SuperWire}
case class Credentials(username: String, password: String) {
private def basicGithub: Github = new RtGithub(username, password)
- def github(implicit userAgent: UserAgent): Github = new RtGithub(basicGithub.entry.through(classOf[SuperWire], userAgent))
+ def github(threshold: Int)(implicit userAgent: UserAgent): Github = new RtGithub(basicGithub.entry.through(classOf[SuperWire], userAgent, new Integer(threshold)))
}
diff --git a/src/main/scala/com/getbootstrap/no_carrier/http/SuperWire.scala b/src/main/scala/com/getbootstrap/no_carrier/http/SuperWire.scala
index 28effd7..00ac8ca 100644
--- a/src/main/scala/com/getbootstrap/no_carrier/http/SuperWire.scala
+++ b/src/main/scala/com/getbootstrap/no_carrier/http/SuperWire.scala
@@ -3,12 +3,11 @@ package com.getbootstrap.no_carrier.http
import java.util.{Collection=>JavaCollection}
import java.util.Map.{Entry=>MapEntry}
import java.io.InputStream
-import com.jcabi.http._
-import com.jcabi.http.wire.RetryWire
+import com.jcabi.github.wire.RetryCarefulWire
+import com.jcabi.http.{Wire,Request,Response}
-case class SuperWire(private val wire: Wire, userAgent: UserAgent) extends Wire {
- // FIXME: use RetryCarefulWire once it's available
- private val wrappedWire = UserAgentWire(wire = new RetryWire(wire), userAgent = userAgent)
+case class SuperWire(private val wire: Wire, userAgent: UserAgent, threshold: Int) extends Wire {
+ private val wrappedWire = UserAgentWire(wire = new RetryCarefulWire(wire, threshold), userAgent = userAgent)
@Override
def send(