Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error in store converter hangs store.get() calls indefinitely #660

Open
jacobian2020 opened this issue Oct 4, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@jacobian2020
Copy link

Describe the bug
When store.get() is called to retrieve a value, it should throw or return value. It should not hang indefinitely.

To Reproduce
Steps to reproduce the behavior:
The following unit test will confirm the behavior.

class StoreTest {

    @Test
    fun error_in_store_converter_causes_call_to_never_return() {
        val store =
            StoreBuilder
                .from(
                    fetcher = Fetcher.of { key: Int -> "fetcher_${key}" },
                    sourceOfTruth = SourceOfTruth.of(
                        reader = { key ->
                            flow<String> {
                                emit("source_of_truth_${key}")
                            }
                        },
                        writer = { _: Int, _: String ->

                        }
                    ),
                    converter = object : Converter<String, String, String> {
                        override fun fromNetworkToLocal(network: String): String {
                            throw IllegalArgumentException()
                        }

                        override fun fromOutputToLocal(output: String): String {
                            return output
                        }
                    },
                ).validator(Validator.by { false }).disableCache().build()

        val key = 1
        val result = runBlocking { store.get(key = key) }
        //The following line is never reached
        Assert.assertEquals("source_of_truth_${key}",result)
    }
}

Expected behavior
Test should complete and not hang indefinitely.

Smartphone (please complete the following information):

  • Device: x86 workstation (NOT a smartphone)
  • OS: Linux
  • Store Version: 5.1.0-alpha02

Additional context
This error is logged in stdout. But it is never thrown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🆕 Triage
Development

No branches or pull requests

1 participant