Skip to content

Commit 72c9246

Browse files
Fix issue SuspendConnection (#191)
Co-authored-by: Rachel M. Carmena <[email protected]>
1 parent 4b78782 commit 72c9246

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

arrow-libs/fx/.github/workflows/build_arrow-fx.yml

+2-11
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,14 @@ jobs:
1616
- uses: actions/checkout@v1
1717
- name: Validate Gradle Wrapper
1818
uses: gradle/wrapper-validation-action@v1
19-
- name: Cache management
20-
uses: actions/cache@v2
21-
with:
22-
path: ~/.gradle/caches
23-
key: ${{ runner.os }}--gradle--${{ hashFiles('**/*.gradle*') }}
24-
restore-keys: |
25-
${{ runner.os }}--gradle--
2619
- name: Checkout orchestrator
2720
run: |
2821
cd $BASEDIR
2922
git clone https://github.com/arrow-kt/arrow.git
3023
- name: Build with Gradle
3124
run: |
32-
$BASEDIR/arrow/scripts/project-build.sh $ARROW_LIB
25+
./gradlew build
26+
#$BASEDIR/arrow/scripts/project-build.sh $ARROW_LIB
3327
#- name: Run benchmark for master branch
3428
# run: |
3529
# git checkout master
@@ -44,6 +38,3 @@ jobs:
4438
# run: |
4539
# export PULL_REQUEST_NUMBER=$(echo $GITHUB_REF | cut -d/ -f3)
4640
# ./gradlew :arrow-benchmarks-fx:compareBenchmarksCI
47-
- name: Clean SNAPSHOTs
48-
run: |
49-
find ~/.gradle/caches/ -type d -name "*SNAPSHOT*" -prune -exec rm -rf {} +

arrow-libs/fx/arrow-fx-coroutines/src/main/kotlin/arrow/fx/coroutines/SuspendConnection.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ package arrow.fx.coroutines
33
import kotlinx.atomicfu.AtomicRef
44
import kotlinx.atomicfu.atomic
55
import kotlin.coroutines.AbstractCoroutineContextElement
6+
import kotlin.coroutines.Continuation
67
import kotlin.coroutines.CoroutineContext
8+
import kotlin.coroutines.EmptyCoroutineContext
9+
import kotlin.coroutines.startCoroutine
710

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

8487
override tailrec fun push(token: CancelToken): Unit = when (val list = state.value) {
8588
// If connection is already cancelled cancel token immediately.
86-
null -> Platform.unsafeRunSync { token.invoke() }
89+
null -> token.cancel
90+
.startCoroutine(Continuation(EmptyCoroutineContext) { })
8791
else ->
8892
if (state.compareAndSet(list, listOf(token) + list)) Unit
8993
else push(token)

arrow-libs/fx/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SUBPROJECT_CONF=https://raw.githubusercontent.com/arrow-kt/arrow/master/subproje
55
DOC_CONF=https://raw.githubusercontent.com/arrow-kt/arrow/master/doc-conf.gradle
66
PUBLISH_CONF=https://raw.githubusercontent.com/arrow-kt/arrow/master/publish-conf.gradle
77
# Gradle options
8-
org.gradle.jvmargs=-Xmx7g
8+
org.gradle.jvmargs=-Xmx4g
99
org.gradle.parallel=true
1010
# Kotlin configuration
1111
kotlin.incremental=true

0 commit comments

Comments
 (0)