Skip to content

Conversation

@devslash-paul
Copy link
Owner

@devslash-paul devslash-paul commented Jun 28, 2021

Fixes #17

import net.devslash.err.RetryOnTransitiveError
import java.time.Duration
import java.util.*
import kotlin.reflect.KMutableProperty0
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snip


dependencies {
implementation(kotlin("stdlib", kotlinVersion))
implementation(kotlin("reflect", kotlinVersion))
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snip?

)
}

fun <T> lock(field: KMutableProperty0<RequestDataSupplier<T>?>) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

document

/**
* Lockable value is a delegate pattern that allows for a marker annotation to be used to lock.
*
* Doesn't work on primitives. If you want it to work on a primitive, then wrap it in a data class for now
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data class -> value class

}
}

class AlreadySetException2 :
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snip

@DSLLockedValue
class ProtectedDS<T>(val ds: RequestDataSupplier<T>) : RequestDataSupplier<T> {
override suspend fun getDataForRequest(): RequestData? = ds.getDataForRequest()
} No newline at end of file
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line

}
call<Int>(address) {
data = ListDataSupplier(listOf(1, 2, 3))
lock(this::data)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to specific example

@codecov
Copy link

codecov bot commented Jun 28, 2021

Codecov Report

Merging #31 (53d64e2) into master (3052265) will increase coverage by 1.93%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #31      +/-   ##
============================================
+ Coverage     69.64%   71.57%   +1.93%     
- Complexity       93       95       +2     
============================================
  Files            30       30              
  Lines           481      482       +1     
  Branches         70       70              
============================================
+ Hits            335      345      +10     
+ Misses          103       94       -9     
  Partials         43       43              
Impacted Files Coverage Δ
...src/main/kotlin/net/devslash/HttpSessionManager.kt 73.61% <100.00%> (ø)
...net/devslash/data/CheckpointingFileDataSupplier.kt 66.66% <100.00%> (+0.70%) ⬆️
.../src/main/kotlin/net/devslash/KtorClientAdapter.kt 76.92% <0.00%> (+7.69%) ⬆️
...ce/src/main/kotlin/net/devslash/RequestProducer.kt 73.17% <0.00%> (+12.19%) ⬆️
service/src/main/kotlin/net/devslash/Runner.kt 94.11% <0.00%> (+17.64%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3052265...53d64e2. Read the comment docs.


internal class LockableValueTest {

// What i can do is have `lock` as a
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snip

x = null
assertThat(x, `is`(nullValue()))
}
} No newline at end of file
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

val rd = supplier.getDataForRequest()!!
val rd2 = supplier.getDataForRequest()!!

runHttp {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

@devslash-paul devslash-paul added test and removed test labels Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WIP Idea: Add checkpointing to continue requests after failures

2 participants