This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Number of requests: 42 | |
########################################## | |
Starting to fetch parameters from futures! | |
Time spent for a chunk: 312ms | |
Time spent for a chunk: 318ms | |
Time spent for a chunk: 319ms | |
Time spent for a chunk: 318ms | |
Time spent for a chunk: 320ms | |
Time spent for a chunk: 321ms | |
Time spent for a chunk: 321ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g": 0} | |
arc-gha-rs-controller-55db6fd4c8-4lnrd manager 2023-12-08T10:49:23Z INFO EphemeralRunnerSet Scaling comparison {"ephemeralrunnerset": {"name":"arc-runner-set-85ndg","namespace":"github-arc-runners"}, "current": 5, "desired": 5} | |
arc-gha-rs-controller-55db6fd4c8-4lnrd manager 2023-12-08T10:49:23Z INFO AutoscalingRunnerSet Find existing ephemeral runner set {"autoscalingrunnerset": {"name":"arc-runner-set","namespace":"github-arc-runners"}, "name": "arc-runner-set-85ndg", "specHash": "68f7894"} | |
arc-gha-rs-controller-55db6fd4c8-4lnrd manager 2023-12-08T11:09:46Z INFO EphemeralRunnerSet Ephemeral runner counts {"ephemeralrunnerset": {"name":"arc-runner-set-85ndg","namespace":"github-arc-runners"}, "pending": 0, "running": 5, "finished": 0, "failed": 0, "deleting": 0} | |
arc-gha-rs-controller-55db6fd4c8-4lnrd manager 2023-12-08T11:09:46Z INFO EphemeralRunnerSet Scaling comparison {"ephemeralrunnerset": {"name":"arc-runner-set-85ndg","namespace":"github-arc-runners"}, "current": 5, "desired": 5} | |
arc-gha-rs-contr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Dynamically discover and add modules in our project | |
* */ | |
val moduleBuildFileName = "build.gradle.kts" | |
// A pattern to match the prefix of our modules | |
val eligibleModuleNamePattern = "a_pattern_to_match_our_module_names".toRegex() // (e.g.: (app|android-|kotlin-).*) | |
// Filter directories that indicate modules | |
val moduleFilter: FileFilter = FileFilter { pathname: File -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class ResultUseCase<Type, in Params> where Type : Any { | |
protected abstract val workDispatcher: CoroutineDispatcher | |
abstract suspend fun run(params: Params): Result<Type> | |
suspend operator fun invoke(params: Params): Result<Type> = withContext(workDispatcher) { | |
run(params) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class NoResultUseCase<in Params> { | |
protected abstract val workDispatcher: CoroutineDispatcher | |
abstract suspend fun run(params: Params) | |
suspend operator fun invoke(params: Params) = withContext(workDispatcher) { | |
run(params) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ObservableUseCase<Type> { | |
val dispatcher: CoroutineDispatcher | |
fun observe(): Flow<Type> | |
} | |
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class) | |
abstract class FlowUseCase<Type : Any, Params : Any> : ObservableUseCase<Type> { | |
private val channel = ConflatedBroadcastChannel<Params>() | |
operator fun invoke(params: Params) = channel.sendBlocking(params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OurViewModel(observeGithubReposUseCase: ObserveGithubReposUseCase): ViewModel { | |
val githubRepos: LiveData<List<GithubRepoItem>> | |
get() = observeGithubReposUseCase | |
.observe() | |
.map { reposList -> | |
reposList | |
.sortedByDescending { it.stars } | |
.map { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OurViewModel: ViewModel() { | |
private val _intentChannel = ConflatedBroadcastChannel<OurViewIntent>() | |
init { | |
_intentChannel | |
.asFlow() | |
.onEach { viewIntent -> | |
when (viewIntent) { | |
OurViewIntent.Refresh -> refreshData() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Suppress("UNCHECKED_CAST") | |
class ViewModelFactory @Inject constructor( | |
private val creators: Map<Class<out ViewModel>, Provider<ViewModel>> | |
) : ViewModelProvider.Factory { | |
override fun <T : ViewModel> create(modelClass: Class<T>): T { | |
val creator = creators[modelClass] | |
?: creators.asIterable().find { (key, _) -> modelClass.isAssignableFrom(key) }?.value | |
?: throw IllegalArgumentException("Unknown ViewModel class $modelClass") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.koin.dsl.module | |
val usecaseModule = module { | |
factory { | |
RefreshGithubReposUseCase( | |
appCoroutineDispatchers = get(), | |
githubRemoteRepo = get(), | |
githubLocalRepo = get() | |
) | |
} |
NewerOlder