GitHub PullRequestReviewCommentEvent at 2014-01-10 08:59:29
Repository: akka
Actor: krasserm
Payload: {"comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/8782857","id":8782857,"diff_hunk":"@@ -52,18 +52,21 @@ private[persistence] trait InmemMessages {\n     case None     ⇒ messages\n   }\n \n-  def read(pid: String, fromSnr: Long, toSnr: Long): immutable.Seq[PersistentRepr] = messages.get(pid) match {\n-    case Some(ms) ⇒ ms.filter(m ⇒ m.sequenceNr >= fromSnr && m.sequenceNr <= toSnr)\n+  def read(pid: String, fromSnr: Long, toSnr: Long, max: Long): immutable.Seq[PersistentRepr] = messages.get(pid) match {\n+    case Some(ms) ⇒ ms.filter(m ⇒ m.sequenceNr >= fromSnr && m.sequenceNr <= toSnr).take(safeLongToInt(max))\n     case None     ⇒ Nil\n   }\n \n-  def maxSequenceNr(pid: String): Long = {\n+  def highestSequenceNr(pid: String): Long = {\n     val snro = for {\n       ms ← messages.get(pid)\n       m ← ms.lastOption\n     } yield m.sequenceNr\n     snro.getOrElse(0L)\n   }\n+\n+  private def safeLongToInt(l: Long): Int =\n+    if (Int.MaxValue.toLong < l) Int.MaxValue else l.toInt","path":"akka-persistence/src/main/scala/akka/persistence/journal/inmem/InmemJournal.scala","position":30,"original_position":30,"commit_id":"7c3406a350021e6a9134f6d66e9e3f99908123dc","original_commit_id":"7c3406a350021e6a9134f6d66e9e3f99908123dc","user":{"login":"krasserm","id":202907,"avatar_url":"https://gravatar.com/avatar/9fa46b50abc760dc7ad2a4c4a3d44136?d=https%3A%2F%2Fidenticons.github.com%2F964b1bee1cc03e43cc95ef4e1aaecd4a.png&r=x","gravatar_id":"9fa46b50abc760dc7ad2a4c4a3d44136","url":"https://api.github.com/users/krasserm","html_url":"https://github.com/krasserm","followers_url":"https://api.github.com/users/krasserm/followers","following_url":"https://api.github.com/users/krasserm/following{/other_user}","gists_url":"https://api.github.com/users/krasserm/gists{/gist_id}","starred_url":"https://api.github.com/users/krasserm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krasserm/subscriptions","organizations_url":"https://api.github.com/users/krasserm/orgs","repos_url":"https://api.github.com/users/krasserm/repos","events_url":"https://api.github.com/users/krasserm/events{/privacy}","received_events_url":"https://api.github.com/users/krasserm/received_events","type":"User","site_admin":false},"body":"Right, can be removed.","created_at":"2014-01-10T08:59:29Z","updated_at":"2014-01-10T08:59:29Z","html_url":"https://github.com/akka/akka/pull/1915#discussion_r8782857","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/1915","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/8782857"},"html":{"href":"https://github.com/akka/akka/pull/1915#discussion_r8782857"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/1915"}}}}