Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Commit

Permalink
Fix issue SuspendConnection (#191)
Browse files Browse the repository at this point in the history
Co-authored-by: Rachel M. Carmena <rachelcarmena@users.noreply.github.com>
  • Loading branch information
nomisRev and rachelcarmena authored Jun 22, 2020
1 parent 6c96760 commit e26ebeb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/build_arrow-fx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,14 @@ jobs:
- uses: actions/checkout@v1
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Cache management
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}--gradle--${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}--gradle--
- name: Checkout orchestrator
run: |
cd $BASEDIR
git clone https://github.com/arrow-kt/arrow.git
- name: Build with Gradle
run: |
$BASEDIR/arrow/scripts/project-build.sh $ARROW_LIB
./gradlew build
#$BASEDIR/arrow/scripts/project-build.sh $ARROW_LIB
#- name: Run benchmark for master branch
# run: |
# git checkout master
Expand All @@ -44,6 +38,3 @@ jobs:
# run: |
# export PULL_REQUEST_NUMBER=$(echo $GITHUB_REF | cut -d/ -f3)
# ./gradlew :arrow-benchmarks-fx:compareBenchmarksCI
- name: Clean SNAPSHOTs
run: |
find ~/.gradle/caches/ -type d -name "*SNAPSHOT*" -prune -exec rm -rf {} +
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ package arrow.fx.coroutines
import kotlinx.atomicfu.AtomicRef
import kotlinx.atomicfu.atomic
import kotlin.coroutines.AbstractCoroutineContextElement
import kotlin.coroutines.Continuation
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.startCoroutine

/**
* Inline marker to mark a [CancelToken],
Expand Down Expand Up @@ -83,7 +86,8 @@ internal sealed class SuspendConnection : AbstractCoroutineContextElement(Suspen

override tailrec fun push(token: CancelToken): Unit = when (val list = state.value) {
// If connection is already cancelled cancel token immediately.
null -> Platform.unsafeRunSync { token.invoke() }
null -> token.cancel
.startCoroutine(Continuation(EmptyCoroutineContext) { })
else ->
if (state.compareAndSet(list, listOf(token) + list)) Unit
else push(token)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SUBPROJECT_CONF=https://raw.githubusercontent.com/arrow-kt/arrow/master/subproje
DOC_CONF=https://raw.githubusercontent.com/arrow-kt/arrow/master/doc-conf.gradle
PUBLISH_CONF=https://raw.githubusercontent.com/arrow-kt/arrow/master/publish-conf.gradle
# Gradle options
org.gradle.jvmargs=-Xmx7g
org.gradle.jvmargs=-Xmx4g
org.gradle.parallel=true
# Kotlin configuration
kotlin.incremental=true
Expand Down

0 comments on commit e26ebeb

Please sign in to comment.