question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't build fork to test

See original GitHub issue

I’m trying to test my fork but it won’t build because of: AGPBI: {"kind":"error","text":"Program type already present: com.tonyodev.fetch2.BuildConfig","sources":[{}],"tool":"D8"}

Regardless maybe you could look at my commit, https://github.com/sethchhim/Fetch/commit/9d4da298eae05895c49e894ac8dea0f29e556166

I need a way to know when download is REPLACED. Now that I think about it maybe onDeleted is the correct place to update instead of adding a new one, probably add an isReplaced boolean. Let me know your thoughts, thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
beforacommented, Sep 4, 2018
    internal fun download(login: Login, downloadList: List<Book>, savePath: String) {
        downloadList.forEach {
            val request = createRequest(login, it, savePath)
            deleteMatchingRequestsWithDifferentFileName(request)
            fetch.enqueue(request, Func { r -> onRequestQueueSuccess(r) }, Func { e -> onRequestQueueFail(e) })
        }
    }

    private fun deleteMatchingRequestsWithDifferentFileName(request: Request) {
        getDownloads().observeForever {
            it?.let {
                it.forEach {
                    val isRequestExistWithDifferentFileName = it.url == request.url && it.file != request.file
                    if (isRequestExistWithDifferentFileName) delete(it)
                }
            }
        }
    }

Here is my solution, I went nuclear and just deleted the download if there was a matching request with a different filename. I think this is fine because changing save path is not a frequent event and I will warn the user. I apologize, I misunderstood REPLACE_EXISTING. I didn’t read the documentation and assumed it meant replace if existing “url” but it means replace if existing “filename”. With this cleared up, your method of deleting the file and not updating the listener is correct. The ui now works as intended, you can close if you want and thanks for the help.

1reaction
beforacommented, Sep 3, 2018

I will try a workaround using the enqueue callback, thanks for the consideration. Also your code is so clean, I’m going to study it more because I rarely use interface contracts. It looks good.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test Build failed for "sh: 1: Cannot fork " · Issue #274 - GitHub
Test build exit and failed unexpected with following message: 22:26:50 ... Test Build failed for "sh: 1: Cannot fork " #274.
Read more >
Play 2.3.7 when fork in Test = false config options are ignored
I'm using play 2.3.7 When fork in Test := false in my build.sbt the conf files aren't loaded by play when running tests....
Read more >
What does the error message "fork failed: Resource ...
Root Cause. There can be various reasons for processes not being able to fork: There is a misbehaving service or process running, consuming ......
Read more >
How to Conduct a Tuning Fork Test - YouTube
Sujana S. Chandrasekhar, MD demonstrates the correct way to conduct tuning fork tests. ... Your browser can't play this video.
Read more >
Maven Surefire Plugin – Fork Options and Parallel Test ...
The surefire offers a variety of options to execute tests in parallel, allowing you to make best use of the hardware at your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found