Skip to content
This repository was archived by the owner on Dec 7, 2019. It is now read-only.
This repository was archived by the owner on Dec 7, 2019. It is now read-only.

SourceFileReader with wrong path to BarCode #332

Open

Description

@phajduk

Hi guys. I think I found bug but please validate my findings described below:
SourceFileReader uses private method pathForBarcode in order to get path for BarCode. However,
SourceFileWriter delegates it to pathResolver.

The bug which above causes is: FileSystemImpl:getRecordState returns RecordState.MISSING all the time as path which was saved by SourceFileWriter is different than path used by SourceFileReader. We talk about the case when BarCode is a key.

Does above make sense?

Activity

  1. KevCron commented on Apr 27, 2018

    @KevCron
    Contributor

    Hey @phajduk I understand what you're saying and I'm looking into it now.

    Do you have any code samples that will help by any chance? Maybe an example of the bug?

  2. phajduk commented on Apr 30, 2018

    @phajduk
    Author

    Hey @KevCron
    OK so I have following configuration of my Store:

        private val constructionForUpload = FluentStoreBuilder.parsedWithKey<BarCode, BufferedSource, ConstructionsResponse>(
                Fetcher {
                    api.getConstructions().map { it.source() }
                }) {
            parsers = listOf(GsonParserFactory.createSourceParser(gson, ConstructionsResponse::class.java))
            persister = RecordPersisterFactory.create(FileSystemFactory.create(context.cacheDir), 10L, TimeUnit.SECONDS)
            memoryPolicy = MemoryPolicy.builder().setExpireAfterWrite(5).setExpireAfterTimeUnit(TimeUnit.SECONDS).build()
            stalePolicy = StalePolicy.REFRESH_ON_STALE
        }
    

    If I understood Store lib properly following statements are true:

    • treat cached data in memory data as up-to-date for 5s
    • treat cached data in File System as up-to-date for 10s

    So after 10 secs data is treat as STALE and fetch call should be performed.

    As an addition to bug description I can see that StoreUtil.persisterIsStale always returns true because RecordState recordState = provider.getRecordState(key); is always RecordState.MISSING.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions