Skip to content

Instantly share code, notes, and snippets.

Avatar

Kasper Kondzielski ghostbuster91

View GitHub Profile
@ghostbuster91
ghostbuster91 / gist:78c41f1b2e77fb0c7a0f22045fb51917
Created Aug 24, 2020
postgers_synchronous_replication_summary
View gist:78c41f1b2e77fb0c7a0f22045fb51917
+--------------+----------------+-----------------------------------------------------+
| | local | standbys |
+--------------+----------------+-------------------+----------------+----------------+
| | durable commit | query consistency | durable commit | durable commit |
| | | | after OS crash | after PG crash |
+--------------+----------------+-------------------+----------------+----------------+
| remote_apply | X | X | X | X |
+--------------+----------------+-------------------+----------------+----------------+
| on | X | | X | X |
+--------------+----------------+-------------------+----------------+----------------+
View withdraw_service_story_13.scala
class WithdrawBatchingExecutor(repository: WithdrawalRepository,
externalSystem: ExternalWithdrawSystem) {
def startExecutor: Observable[Unit] =
Observable
.intervalWithFixedDelay(config.interval)
.mapEval( _ => repository.findAllWaitingOrderedBySerialIdAsc())
.distinctUntilChanged
.scan(List.empty[Withdrawal]) { (oldSet, newSet) =>
newSet.takeWhile(w => !oldSet.contains(w))
View withdraw_service_story_12.scala
def mergeMap[B](f: A => Observable[B])(
implicit os: OverflowStrategy[B] = OverflowStrategy.Default): Observable[B]
View withdraw_service_story_11.scala
def groupBy[K](keySelector: A => K)(
implicit os: Synchronous[Nothing] = OverflowStrategy.Unbounded
): Observable[GroupedObservable[K, A]]
View withdraw_service_story_10.scala
Observable
.intervalWithFixedDelay(config.interval)
.mapEval( _ => repository.findAllWaitingOrderedBySerialIdAsc(config.maxBatchSize))
.distinctUntilChanged
.scan(List.empty[Withdrawal]) { (oldSet, newSet) =>
newSet.takeWhile(w => !oldSet.contains(w))
}
.flatMap(Observable.fromIterable)
.bufferTimedAndCounted(config.timeWindow, config.batchSizeThreshold)
View withdraw_service_story_9.scala
Observable
.intervalWithFixedDelay(config.interval)
.mapEval( _ => repository.findAllWaitingOrderedBySerialIdAsc(config.maxBatchSize))
.distinctUntilChanged
.scan(List.empty[Withdrawal]) { (oldSet, newSet) =>
newSet.takeWhile(w => !oldSet.contains(w))
}
View withdraw_service_story_8.scala
def distinctUntilChanged[AA >: A](implicit A: Eq[AA]): Observable[AA]
View withdraw_service_story_7.scala
Observable
.intervalWithFixedDelay(config.interval)
.mapEval( _=> repository.findAllWaitingOrderedBySerialIdAsc())
.flatMap(Observable.fromIterable)
.bufferTimeAndCounted(config.timeWindow, config.batchSize)
View withdraw_service_story_6.scala
Observable
.intervalWithFixedDelay(config.interval)
.mapEval( _=> repository.findAllWaitingOrderedBySerialIdAsc())
.flatMap(Observable.fromIterable)