Skip to content

Commit

Permalink
oops, init order
Browse files Browse the repository at this point in the history
  • Loading branch information
patriknw committed Feb 9, 2024
1 parent 3ec6548 commit b8342d3
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions core/src/main/scala/akka/persistence/r2dbc/R2dbcSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,22 @@ final class R2dbcSettings private (
val numberOfDataPartitions: Int) {
import R2dbcSettings.NumberOfSlices

val numberOfDatabases: Int = _connectionFactorySettings.size

val dataPartitionSliceRanges: immutable.IndexedSeq[Range] = {
val rangeSize = NumberOfSlices / numberOfDataPartitions
(0 until numberOfDataPartitions).map { i =>
(i * rangeSize until i * rangeSize + rangeSize)
}.toVector
}

val connectionFactorSliceRanges: immutable.IndexedSeq[Range] = {
val rangeSize = NumberOfSlices / numberOfDatabases
(0 until numberOfDatabases).map { i =>
(i * rangeSize until i * rangeSize + rangeSize)
}.toVector
}

private val _journalTableWithSchema: String = schema.map(_ + ".").getOrElse("") + journalTable

/**
Expand Down Expand Up @@ -321,22 +337,6 @@ final class R2dbcSettings private (
else acc.updated(table, sliceRange.min)
}

val numberOfDatabases: Int = _connectionFactorySettings.size

val dataPartitionSliceRanges: immutable.IndexedSeq[Range] = {
val rangeSize = NumberOfSlices / numberOfDataPartitions
(0 until numberOfDataPartitions).map { i =>
(i * rangeSize until i * rangeSize + rangeSize)
}.toVector
}

val connectionFactorSliceRanges: immutable.IndexedSeq[Range] = {
val rangeSize = NumberOfSlices / numberOfDatabases
(0 until numberOfDatabases).map { i =>
(i * rangeSize until i * rangeSize + rangeSize)
}.toVector
}

/**
* INTERNAL API
*/
Expand Down

0 comments on commit b8342d3

Please sign in to comment.